This topic is locked

Enable/Disable Save Button on Master page based on Child page record

1/15/2014 1:21:42 PM
PHPRunner General questions
A
Abul author

I have an app with "order" master page and "order_detail" child page. I put Child page in the "Tab" folder on "order" add page with "Inline Add" grid option. I see I can save order master page with no entry on order_detail child page, though order_detail page has some required fields to be entered. I want to apply disable/enable option for "SAVE" button on master add page based on data entry in order_detail child page. Means, if there is data entered on the required fields of the order_detail page then only "SAVE" button should enable else it should be disable. Could you please help me with code and where this code should I put.
Thanks in advance.

Sergey Kornilov admin 1/15/2014

Unfortunately we do not have such sample code available.
Most likely you need to add this code to Details table Add/Edit page JavaScript OnLoad event.

Here is the code to enable/disable button:

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

A
Abul author 1/16/2014



Unfortunately we do not have such sample code available.
Most likely you need to add this code to Details table Add/Edit page JavaScript OnLoad event.

Here is the code to enable/disable button:

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


Thanks Admin for reply. But it did not work for me. Because "SAVE" button is on Master Add/Edit Form in my case not on Detail Add/Edit Page. Detail Add/Edit form is in "Tab" folder on my Master Add/Edit page, so there is only one "SAVE" button on Master form only. Another thing how can I put the condition for enable/disable in the code you provided. Thanks again.

Sergey Kornilov admin 1/16/2014

I can confirm that code added to Details table Add/Edit page Javascript OnLoad event is able to disable/enable Save button of the Master table.

A
Abul author 1/16/2014



I can confirm that code added to Details table Add/Edit page Javascript OnLoad event is able to disable/enable Save button of the Master table.


Thanks Admin for so quick reply. I used Detail Form as "Inline Add/Edit" only to accommodate into "Tab" folder on Master page. I didn't create any separate Add/Edit page for detail table. How and where then I should put those code on detail table page? Thanks again.

A
Abul author 1/16/2014



Thanks Admin for so quick reply. I used Detail Form as "Inline Add/Edit" only to accommodate into "Tab" folder on Master page. I didn't create any separate Add/Edit page for detail table. How and where then I should put those code on detail table page? Thanks again.


I checked with your advice and its work now. I see "SAVE" button can be disabled. I put that code to Details table Add/Edit page Javascript OnLoad event. But I like to enable this button when user complete the required fields on detail page. How can I can make this happen conditionally? Could you please give me with some example code? Thanks a lot.

Sergey Kornilov admin 1/16/2014

You need to add your code to 'onchange' event of those required fields.
Take a look at this example:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm
Your code will be fired every time the content of one of fields is changing and this is where you can conditionally enable or disable Save button.

A
Abul author 1/16/2014



You need to add your code to 'onchange' event of those required fields.
Take a look at this example:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm
Your code will be fired every time the content of one of fields is changing and this is where you can conditionally enable or disable Save button.


Dear Admin, Thank you so much. I used this code with no luck. Could you please help me out again? I am not pro php but learner. Thanks.
var ctrlsaveButton = Runner.getControl (pageid, 'saveButton');

var ctrlProviders = Runner.getControl(pageid, 'detailid');
ctrlProviders.on('change', function(e){
if (this.getValue() == '$('input[type=select]'){
ctrlsaveButton.enable();

}else{

ctrlsaveButton.disable();

}

});

Sergey Kornilov admin 1/16/2014

Unfortunately we do not have sample code tailored for this specific task. You either need to learn a bit of Javascript or to hire someone to do this for you.
I recommend contacting Cristian to get a quote for this sort of task:

http://www.asprunner.com/forums/user/7513-cristian-gil/
Another option - check our custom software development services at http://xlinesoft.com/buy_support.htm.