Save and Next buttons

Hi,

Is it possible to have 2 buttons in a form, at same time, one to update data, and the other to update data and redirect to another form ? I added a PHP button to a form, but i can only redirect with sc_redir, without the possibility of posting data, I tried too a javascript button, but no success, any one have a solution to this, please. Thank you.

regards

Re: Save and Next buttons

Hello,

Try using the following code:

nm_atualiza ('alterar');
window.location = "http://www.google.com/";

regards,
Bernhard Bernsmann

Re: Save and Next buttons

The above code don’t work, I tried it before, it will redirect the page, but the field values are not saved in database.

Re: Save and Next buttons

Hello,

It worked flawlessly here, you should create a JavaScript button, instead of a PHP button.

regards,
Bernhard Bernsmann

Re: Save and Next buttons

Yes, my button type is JS, may be, the problem is OnAfterUpdate Event, there is some instructions in this event. i will try the code without theme.

Re: Save and Next buttons

No, even without afterupdate event, still not work, any idea?

Re: Save and Next buttons

Try creating a new application, to see if it works.

regards,
Bernhard Bernsmann

Re: Save and Next buttons

Hi,

I tested with a new application, and the first time i update the data, it work, but if i return back to the form in the same browser window and i post again data with the new button, the datas are not stored in the database, and only the redirection is executed. I think we should, wait until the confirmation of updated datas occured (Ajax: xhr.readyState == 4) to perform the redirection…

Re: Save and Next buttons

Is there a method, to send a parameter to PHP functions from Javascript Button, in this way, i will be able to distinguish between the Save button provided by Scriptcase and the new button i created on the form (both call nm_actualiza(‘alterar’) ). So, in the OnAfterUpdate Event, I will make the redirection, only if the parameter have been defined…

Re: Save and Next buttons

Hello,

As PHP is parsed server side and Javascript is parsed client side, this may be a little difficult.

To make things simpler you could create a JavaScript button and to update your records (no redirection there, just nm_atualiza), and, on the onAfterUpdate event you could use sc_redir to redirecting anywhere.

onAfterUpdate:
sc_redir (http://www.google.com);

regards,
Bernhard Bernsmann