CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
This example shows how to hide a control on a Record form. In this case, a Record form called Responses has a Text box control called Author that should not be displayed.
<tr> <td>Author</td> <td> <!-- BEGIN TextBox Author --> <input name="Author" value="{Author}"> <!-- END TextBox Author --> </td> </tr>Or you can also add the code at the beginning and at the end of the table row to hide the control together with its caption:
<!-- BEGIN TextBox Author --> <tr> <td>Author</td> <td><input name="Author" value="{Author}"></td> </tr> <!-- END TextBox Author -->
One way to hide a control is to place code in the Before Show event of the control itself. Another method is to add code in the Before Show event of the form in which the control is contained. We shall begin with the first method where the code is added to the Before Show event of the control itself.
Function Responses_Author_BeforeShow() Responses.Author.Visible = False End Function
function Responses_Author_BeforeShow() { global $Responses; $Responses->Author->Visible = False; }
sub Responses_Author_BeforeShow() { $Responses->{Author}->{Visible} = 0; }
<!---Responses_Author_BeforeShow ---> <CFSET hideAuthor = True>
'Responses_Author_BeforeShow ResponsesAuthor.Visible = False
//Responses_Author_BeforeShow ResponsesAuthor.Visible = false;
//Responses_Author_BeforeShow e.getControl().setVisible(false);
The second method of hiding controls is to place code in the Before Show event of the form in which the control is contained. Using this method, you can hide multiple controls within the form since they are all accessible at the form level. This is not the case when the code is added to the Before Show event of one of the controls.
Function Responses_BeforeShow() Responses.Author.Visible = False Responses.AuthorEmail.Visible = False End Function
function Responses_BeforeShow() { global $Responses; $Responses->Author->Visible = False; $Responses->AuthorEmail->Visible = False; }
sub Responses_BeforeShow() { $Responses->{Author}->{Visible} = 0; $Responses->{AuthorEmail}->{Visible} = 0; }
<!---Responses_BeforeShow ---> <CFSET hideAuthor = True>
'Responses_BeforeShow ResponsesAuthor.Visible = False
//Responses_BeforeShow ResponsesAuthor.Visible = false;
//Responses_BeforeShow e.getRecord().getControl("Author").setVisible(false);