CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
The objects in the Web applications generated by CodeCharge Studio can be referenced in a variety of ways. In many cases, to work with a specific object within a program you will need to know its position within the program hierarchy. For example, an object that is placed directly on the page may need to be addressed differently compared to an object placed within a form (which is also an object).
Examples of working with objects | Syntax | |
---|---|---|
Form object placed on a page | Page Events | <form>.Visible = False |
Form Events | EventCaller.Visible = False | |
Control object placed within a form | Page Events | <form>.<control>.Value = "123" |
Form Events | EventCaller.<control>.Value = "123" | |
Control Events | EventCaller.Value = "123" | |
Control object placed on a page | Page Events | <control>.Value = "ABC" |
Control Events | EventCaller.Value = "ABC" | |
Control object placed on an included page | Main Page Events | <page>.<control>.Visible = False |
Includable Page Events | EventCaller.<control>.Visible = False | |
Control Events | EventCaller.Visible = False | |
Form object placed on an included page | Main Page Events | <page>.<form>.Visible = False |
Includable Page Events | EventCaller.<form>.Visible = False | |
Form Events | EventCaller.Visible = False | |
Control object placed in a form within an included page | Main Page Events | <page>.<form>.<control>.Visible = False |
Includable Page Events | EventCaller.<form>.<control>.Visible = False | |
Form Events | EventCaller.<control>.Visible = False | Control Events | EventCaller.Visible = False |
Note: Using EventCaller is recommended when planning to reuse the event code since it doesn't require referring to objects by name.
When using PHP you can address objects in a generic way as $Component to refer to the component raising the event, and $Container to refer to the host form of $Component. This method of referring to objects is recommended to make the event code reusable since it doesn't require referring to objects by name. You can also refer to objects using global variables, for example use $MyGrid to refer to 'MyGrid' grid.
Examples of working with objects in a generic way | Syntax | |
---|---|---|
Form object placed on a page | Page Events | $Component->form->visible = false; |
Form Events | $Component->Visible = false; | |
Control object placed within a form | Page Events | $Component->form->control->SetValue($Component->form->PageNumber); |
Form Events | $Component->control->SetValue($Component->PageNumber); | |
Control Events | $Component->SetValue($Container->PageNumber); | |
Control object placed on a page | Page Events | $Component->control->SetValue("ABC"); |
Control Events | $Component->SetValue("ABC"); | |
Control object placed on an included page | Main Page Events | $Component->page->control->Visible = false; |
Includable Page Events | $Component->control->Visible = false; | |
Control Events | $Component->Visible = false; | |
Form object placed on an included page | Main Page Events | $Component->page->form->Visible = false; |
Includable Page Events | $Component->form->Visible = false; | |
Form Events | $Component->Visible = false; | |
Control object placed in a form within an included page | Main Page Events | $Component->page->form->control->Visible = false; |
Includable Page Events | $Component->form->control->Visible = false; | |
Form Events | $Component->control->Visible = false; | Control Events | $Component->Visible = false; |
Examples of working with objects using global variables | Syntax |
---|---|
Form object placed on a page | $form->Visible = false; |
Control object placed within a form | $form->control->SetValue("123"); |
Control object placed on a page | $control->SetValue("ABC"); |
Control object placed on an included page | $page->control->Visible = false; |
Form object placed on an included page | $page->form->Visible = false; |
Control object placed in a form within an included page | $page->form->control->Visible = false; |
Examples of working with objects | Syntax |
---|---|
Form object placed on a page | $<form>->{Visible} = 0; |
Control object placed within a form | $<form>->{<control>}->SetValue("123"); |
Control object placed on a page | $<control>->SetValue("ABC"); |
Control object placed on an included page | $<page>->{<control>}->{Visible} = 0; |
Form object placed on an included page | $<page>->{<form>}->{Visible} = 0; |
Control object placed in a form within an included page | $<page>->{<form>}->{<control>}->{Visible} = 0; |
Assigning an object to a variable | $<variable> = $<object>; |
Examples of working with objects | Syntax | |
---|---|---|
Form object placed on a page | Page Events | e.getPage().getComponent("<form>").setVisible(false); |
Form Events | e.getComponent().setVisible(false); | |
Control object placed within a form | Page Events | e.getPage().getComponent("<form>").getControl("<control>").setValue("123"); |
Form Events | e.getComponent().getControl("<control>").setValue("123"); | |
Control Events | e.getControl().setValue("123"); | |
Control object placed on a page | Page Events | e.getPage().getControl("<control>").setValue("ABC"); |
Control Events | e.getControl().setValue("ABC"); | |
Assigning an object to a variable | <variable> = <object>; |
Note: The syntax for accessing objects in an included page from events within the same included page is the same as specified above. The syntax for accessing objects in an included page from events within the including page is not supported. The syntax for accessing objects in the including page from events within the included page is also not supported.
Examples of working with objects | Syntax | |
---|---|---|
Form object placed on a page | Grid and Editable Grid Events | <form>Repeater.Visible = false; |
Record Events | <form>Holder.Visible = false; | |
Directory and Path Events | <form>.Visible = false; | |
Control object placed within a Record form | <form><control>.Visible = false; | |
Control object placed within a Grid, Editable Grid, Directory and Path form | Control's Before Show Event | <form><control>.Visible = false; |
Form's Before Show and Before Show Row Event | Object reference should be retrieved from the FormControls collection. See the ItemDataBound Event MSDN example. |
|
Control object placed on a page | <control>.Visible = false; | |
Assigning an object to a variable | <variable> = <object>; |
Note: The syntax for accessing objects in an included page from events within the same included page is the same as specified above. The syntax for accessing objects in an included page from events within the including page is not supported. The syntax for accessing objects in the including page from events within the included page is also not supported.
Examples of working with objects | Syntax | |
---|---|---|
Form object placed on a page | Grid and Editable Grid Events | <form>Repeater.Visible = False |
Record Events | <form>Holder.Visible = False | |
Directory and Path Events | <form>.Visible = False | |
Control object placed within a Record form | <form><control>.Visible = False | |
Control object placed within a Grid, Editable Grid, Directory and Path form | Control's Before Show Event | <form><control>.Visible = False |
Form's Before Show and Before Show Row Event | Object reference should be retrieved from the FormControls collection. See the ItemDataBound Event MSDN example. |
|
Control object placed on a page | <control>.Visible = False | |
Assigning an object to a variable | <variable> = <object> |
Note: The syntax for accessing objects in an included page from events within the same included page is the same as specified above. The syntax for accessing objects in an included page from events within the including page is not supported. The syntax for accessing objects in the including page from events within the included page is also not supported.
Examples of working with objects | Syntax |
---|---|
Form variable placed on a page or within a form | <CFSET blnReadAllowed<form>=false> |
Control variable placed within a form or a page | <CFSET fld<control> = "abc"> |
Note: The syntax for accessing objects in an included page from events within the same included page is the same as specified above.