NetTalk Central

Author Topic: ONSAVE set to stay, but only saves the first time in a form.  (Read 2945 times)

Mark Sarson

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
ONSAVE set to stay, but only saves the first time in a form.
« on: August 21, 2011, 09:05:33 AM »
Hi

I have a form without a browse.

I call this from from a menu option with the link like so:

'updatemainpassenger?change_btn=change&_bidv_=' & p_web.AddBrowseValue('WebMenu','Customer',CUS:KeyCustomerID,p_web.GSV('CustomerID')) & '&PressedButton=change_btn'

When the user saves their data from this form, I need the form to stay open on the same tab as it was on before the save.

I have tried many ways to do this without avail.

I thought I was onto something when I tried this in the   ! Start of "Set Form Action" embed,

 p_web.SetValue('onsave','stay')  ! Make the target be the same form

This works with the first save I make, but then any save after that,  the post update is not being called, and if I return to the form later, any changes I make on the second and any other attempt after that, changes are lost.

Any help in resolving this would be much appreciated.

Regards


Mark Sarson

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: ONSAVE set to stay, but only saves the first time in a form.
« Reply #2 on: August 21, 2011, 11:16:38 PM »
Hi Mark,

It sounds to me like you're starting with the wrong viewpoint.

The save button on the form does a "submit". Now, you could just set the "URL on Save" to be the same form (with the same parameters) that seems a bit of a clumsy way to do it.

Perhaps what you really should do is remove the Save button from the form altogether, and add a normal button to the form (one for each tab I guess) marked "save". Then in the server-code for this button you can do a manual "save". Ok, that's a little bit more work (you'd need to fetch the record, do a SessionQueue2File call, and a Put) but the form just sits there quite happily.

Presumably you'd then use the "close" button to send the user elsewhere in the program.

Cheers
Bruce