This topic is locked
[SOLVED]

 How to hide/show detail form display from master page conditionally

5/21/2014 4:46:54 AM
PHPRunner General questions
A
Abul author

Is there any way conditionally hide/show detail form on the master page based on check box value on master form? Let say, order is master with order-detail and shipping address two detail forms on the same order_add.php page. There is one check box on master form call "shipping?". Initially shipping detail form will hide from the master page. This will shows up when user check-on the "shipping?" box on master page. I think this can be possible by javascript onLoad event on Master page but I can't figure it out the code syntax. Could you please help me? Thanks.

Sergey Kornilov admin 5/22/2014

Assuming you only have one details table you can use the following on Add/Edit/View page to hide details:

$(".rnr-c-details").hide();


and to show again

$(".rnr-c-details").show();


If you have more than one details table this code will hide or show them all.

A
Abul author 5/22/2014



Assuming you only have one details table you can use the following on Add/Edit/View page to hide details:

$(".rnr-c-details").hide();


and to show again

$(".rnr-c-details").show();


If you have more than one details table this code will hide or show them all.


Thank you so much for your reply admin. I am not sure how this code will show/hide detail page based on condition on master page while Detail form is on master Add/Edit page. Any way this may give me a clue at least. Another thing where should I put this code, could you please illustrate little detail? Thanks in advance.

Sergey Kornilov admin 5/22/2014

Here is an example of executing some Javascript code based on change of state/value of another control:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm

A
Abul author 5/23/2014



Here is an example of executing some Javascript code based on change of state/value of another control:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm


Thank you so much admin. It works. I have several details pages on a single master page. I just tweaked your's code and the code in the manual you referred to get the feature show/hide for specific detail page based on specific control value on master page. here is what I did:

var ctrlControlBoxnameOnMaster = Runner.getControl(pageid, 'control box on master page');
$(".rnr-c-detailspagename").hide();

ctrlControlBoxnameOnMaster.on('change', function(e){

if (this.getValue() == 'YES'){

$(".rnr-c-detailspagename").show();

}else{

$(".rnr-c-detailspagename").hide();

}

});


You need to change ControlBoxNameonMaster and pagename after "rnr-c-details" as per your requirement.