This topic is locked

Before Display on Edit Page

3/9/2011 9:58:08 PM
PHPRunner General questions
R
rkiss author

Hi,
I don't know what I am doing wrong..I am trying to hide some fields using Before Display Event, but it is not working:
Example of my code:



if ($values["audit_type_id"]==1){

// Hides

$xt->assign("annual_accredition_fees_fieldblock",false);

}

else{

// Shows

$xt->assign("annual_accredition_fees_fieldblock",true);

}



-----------------------------
Note, I also have JAVASCRIPT ONLOAD EVENT on the edit page (related to the same field) not sure if this is causing the issue.



ctrlAuditType.on('change', function(e)

{

if (this.getValue() ==1)

{

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

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

}



*depositdiv7 hides the annual_accredition_fees field***
The ONLOAD event works as expected and hides fields based on the selection of Audit Type. However, once you save the record and then try to edit it again, I don't want to display the fields I've hidden using the ONLOAD event, hence the BEFORE DISPLAY event...but it is not working...
Any ideas?
Thank you,
Roman

M
macskafogo 3/10/2011



Hi,
I don't know what I am doing wrong..I am trying to hide some fields using Before Display Event, but it is not working:
Example of my code:



if ($values["audit_type_id"]==1){

// Hides

$xt->assign("annual_accredition_fees_fieldblock",false);

}

else{

// Shows

$xt->assign("annual_accredition_fees_fieldblock",true);

}



-----------------------------
Note, I also have JAVASCRIPT ONLOAD EVENT on the edit page (related to the same field) not sure if this is causing the issue.



ctrlAuditType.on('change', function(e)

{

if (this.getValue() ==1)

{

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

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

}



*depositdiv7 hides the annual_accredition_fees field***
The ONLOAD event works as expected and hides fields based on the selection of Audit Type. However, once you save the record and then try to edit it again, I don't want to display the fields I've hidden using the ONLOAD event, hence the BEFORE DISPLAY event...but it is not working...
Any ideas?
Thank you,
Roman


Use this code:

$xt->assign("annual_accredition_fees_fieldblock",$values["audit_type_id"]==1);

R
rkiss author 3/10/2011



Use this code:

$xt->assign("annual_accredition_fees_fieldblock",$values["audit_type_id"]==1);


Hi, that did not work. annual accredition fees field still shows up on the edit page where Audit Type = 1.

J
Jane 3/10/2011

Roman,
just add this code to your "JavaScript onload event":

if (ctrlAuditType.getValue() ==1)

{

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

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

}



Then use your own code for onchangeevent.