This topic is locked
[SOLVED]

  Save button

10/9/2012 7:42:07 PM
PHPRunner General questions
S
stiven author

Hello Everyone,
I have a question, I am trying to get three save buttons on the Add page.
Save & New

Save & Print

Save & Close
I can not figure out a way to do this, the Save & New button is just the regular save button, but if the Save & Print button is clicked I want to redirect the user to the edit page, then if the Save & Close button is clicked I just want to save the record and close the window.
is this possible? is there any way to achieve this?
Thanks for your help
this is how the buttons look.


<SPAN class=runner-btnframe><SPAN class=runner-btnleft></SPAN><SPAN class=runner-btnright></SPAN><A class=runner-button href="#" {$savebutton_attrs}>Save &amp; New</A></SPAN>

<SPAN class=runner-btnframe><SPAN class=runner-btnleft></SPAN><SPAN class=runner-btnright></SPAN><A class=runner-button href="#" {$savebutton_attrs}>Save Print</A></SPAN>

<SPAN class=runner-btnframe><SPAN class=runner-btnleft></SPAN><SPAN class=runner-btnright></SPAN><A class=runner-button href="#" {$savebutton_attrs}>Save &amp; Close </A></SPAN>


my problem is I don't know how to find out on the events page which button the user clicks.

W
wildwally 10/10/2012

I'm sure there are multiple ways to go about doing this. And I'm not 100% sure what I'm going to post will suit your needs - but maybe you can use it to work your way through the problem.
I found in the forums that you can create a new submit button and within the custom button have your own code. You can also trigger the normal code to save the records and run the before and after events like normal by using this in the javascript on load event.

$("#submit2").bind("click", {page: this}, function(e){

var page = e.data.page;

page.on('beforeSave', function(formObj, fieldControlsArr, pageObj)

{formObj.baseParams['submit2'] = 'Submit';

}, page, {single: true});

page.on('afterSave', function(respObj, formObj, fieldControlsArr, pageObj){

delete formObj.baseParams['submit2'];

}, page, {single: true});

page.saveHn(e);

});


Submit2 is the name of the button.

S
stiven author 10/10/2012

Thanks so much!
This worked for me.