This topic is locked
[SOLVED]

 Programmatically clicking save button while on edit page

5/9/2017 4:23:07 PM
ASPRunner.NET General questions
J
jetsguy author

Does anyone know if/how I script a call the save button? I'd like to save a record from my own custom button.
ASPRunner.Net Enterprise Version 9.7 Build 28565

T
Tim 5/9/2017

Hi Eric,
I once added an additional "save and return" button to the edit page, which saved the record and returned to the list page. I had the regular save button set to save and go to the next record. In the visual editor I added a new button next to the regular save button and in the "Client Before" section I added this:
pageObj.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

formObj.baseParams['golist'] = "1"; });
$("#saveButton1").click();
return false;
Nothing is needed in the "Server" or "Client After" sections.
I hope this helps.

Thanks,

Tim

J
jetsguy author 5/9/2017



Hi Eric,
I once added an additional "save and return" button to the edit page, which saved the record and returned to the list page. I had the regular save button set to save and go to the next record. In the visual editor I added a new button next to the regular save button and in the "Client Before" section I added this:
pageObj.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

formObj.baseParams['golist'] = "1"; });
$("#saveButton1").click();
return false;
Nothing is needed in the "Server" or "Client After" sections.
I hope this helps.

Thanks,

Tim


Thanks for your reply.

Hmmm this does not seem to work. What version do you have? I'm running ASP Runner.Net 9.7. Maybe they changed things?

admin 5/11/2017

It does work in version 9.7 but you only need the following in ClientBefore:

$("#saveButton1").click();
J
jetsguy author 5/11/2017



It does work in version 9.7 but you only need the following in ClientBefore:

$("#saveButton1").click();



Thank you it works for the "edit" page. Any chance there's something that can work for "inline edit" page?

J
jetsguy author 5/11/2017



Thank you it works for the "edit" page. Any chance there's something that can work for "inline edit" page?


Through trail and error I found the answer!!! To press the Save All button on the inline edit page I used the following code instead of the above.
$("#saveall_edited1").click();