This topic is locked

How to hide controls on Add/Edit pages

10/4/2010 2:40:48 AM
PHPRunner General questions
M
magicpal author

Dear sir,
I have a field called "Approval Status" which has two options, "Approved" and "Not Approved".

The next field is "Approval Date".

The "Approval Date" should not be displayed in default.
When "Approved" is chosen, "Approval Date" field should be displayed and vice versa.
Urgent
Magically urs ,

Balu

A
ann 10/5/2010

Balu,
use JavaScript Onload event on the Events tab for this purpose.

Here is a sample:

var ctrlStatus = Runner.getControl(pageid, 'ApprovalStatus');

function func() {

if (ctrlStatus.getValue()=='Approved'){

document.getElementById("hidediv1").style.display="none";

}

else {

document.getElementById("hidediv1").style.display="table-row";

}

};

ctrlStatus.on('keyup', func);


Then edit HTML code for this page on the Visual Editor tab in HTML mode. Check my changes in bold:

{BEGIN ApprovalDate_fieldblock}

<TR id=hidediv1 style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px">

<TD class=editshade_b style="PADDING-LEFT: 15px" width=150>{$label TableName ApprovalDate}</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px" width=250>{$ApprovalDate_editcontrol}

</TD></TR>

{END ApprovalDate_fieldblock}

P
pimelimar 10/29/2010



Balu,
use JavaScript Onload event on the Events tab for this purpose.

Here is a sample:

var ctrlStatus = Runner.getControl(pageid, 'ApprovalStatus');

function func() {

if (ctrlStatus.getValue()=='Approved'){

document.getElementById("hidediv1").style.display="none";

}

else {

document.getElementById("hidediv1").style.display="table-row";

}

};

ctrlStatus.on('keyup', func);


Then edit HTML code for this page on the Visual Editor tab in HTML mode. Check my changes in bold:


Dear Ann and others,
I have put the javascript into Table Events - Add page: javascript on load event and edit HTML code on the Visual editor without the expected result. I become crazy, I have spent several hours on it. Please help me.

A
ann 11/4/2010

Pierre,
make sure you've replaced ApprovalStatus with your actual field name.
If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. 'Demo Account' button can be found on the last screen in the program.