NetTalk Central

Author Topic: Save and Next button for NetWebForm  (Read 17751 times)

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Save and Next button for NetWebForm
« Reply #15 on: June 01, 2012, 07:59:07 AM »
sorry Rob... :(

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #16 on: July 19, 2012, 12:55:14 PM »
Hi Bruce,
You said I could remind you of this request. I will need to make a decision soon on how to handle this problem. I am thinking that I will need to change my NetWebForm from a table to memory source form. I would then add the code to update the record and to get the next record. I would like to keep the NetWebForm  as  a table source form, but there appears to be no way, the NetWebForm will update the table record unless the  NetWebForm is requested from a NetWebBrowse. (e.g. my original example in this thread).

In short, I would be to have capability to call a NetWebForm page (i.e. via the "_SendFile"  method)  from the same or different NetWebForm with the primary key to the file record in session variables and have the NetWebForm handle the record update as if it was called from the NetWebBrowse. Then  the programmer is responsible to get next record for the form, such as building the view, or whatever to get the next record. 

Thanks,
Rob Kolanko

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #17 on: July 19, 2012, 09:58:30 PM »
Hi Rob,

yeah, I haven't had much time to work on this, and I don't yet have an ellegant solution in mind.

>> but there appears to be no way, the NetWebForm will update the table record unless the  NetWebForm is requested from a NetWebBrowse. (e.g. my original example in this thread).

no, this isn't true. Forms can be called "directly" (and often are.) See Web Server FAQ, question #4 to do it via a URL. also notice on the "advanced" tab of the form settings that you can specify the default action for the form, and even bind the form to a record.

In your case you would use the techniques from FAQ #4 for the ID, and you could set the action of the form to "Change" on the advanced tab.

Cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #18 on: July 20, 2012, 11:35:23 AM »
Hi Bruce,
I originally tried calling the form using the method described in FAQ 4 in my example, but it did not work properly. The form appears but the save button does not update the record. Attached is my example of the Save and Next button using the  method described in FAQ 4. The MailboxesFormControl form's Save button will save the record if called from the browse, but the Save button will not save the record if the form is requested by the  _Sendfile function using the FAQ 4 method in the Save and Next button. Have I done something wrong in the example?
Thanks,
Rob Kolanko 

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #19 on: July 22, 2012, 10:52:22 PM »
I changed your approach a bit - example is attached.
note that I changed the "save and next" button to be a "save" button - that's a better starting point.

Bruce


[attachment deleted by admin]

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #20 on: July 23, 2012, 09:21:52 AM »
Hi Bruce,
Unfortunately your example does not work ( I least for me).  I compiled the web1 example posted and observed the following:
Edit the second record (Courtney) change size limit field value and press the Save and Next Button. The Courtney  record is saved and the next record is available for update (Derek).  Change Size limit filed value and press the Save button, and nothing happens. The page does not change and the Save, Save and Next or Cancel buttons no longer not work.

Yet I have seen the Save button work after a Save and Next, but I cannot repeat the process. Not working far exceeds working.  :(

Rob Kolanko

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #21 on: July 24, 2012, 04:36:00 AM »
pah - the work of a single line of embed code to fix that problem...
(ok, I admit, it took a bit of time to figure out exactly what the line should be <g>)

updated example is attached.

[attachment deleted by admin]

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #22 on: July 24, 2012, 07:18:29 AM »
Hi Bruce,
The example works great now. The post update embed code is the "bomb".  ;D I will deploy it in my applications. I think this function is often used in applications and addition to an example would benefit others.
Thanks again, I really appreciate your help.
Rob Kolanko
 

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #23 on: July 26, 2012, 09:24:31 AM »
Hi Bruce,
When I tried to put the Save and Next code into my application, the results where not as expected. When the Save and Next button was selected, the current record was saved successfully and the next record appear in the form, however selecting either the Save or the Save and Next buttons returned to the browse without update.  Debug shows no p_stage events occurred after these Save buttons were pushed and the browse screen returns.  First let us verify that I have not made any errors in entering the PostUpdate embed code. The italicized code is replaced with the values described.

  if p_web.GetValue('_buttontext_') = p_web.translate('Save and Next')
    do GetNextRecord
    p_web.Requestfilename = '<NetWebForm procedure name>'
    p_web.SetValue('<NetWebForm procedure name>_form:inited_',0)
    p_web.setValue('change_btn','change')         
    p_web.SetValue('_parentPage','<NetWebbrowse procedure name that called the NetWebForm>')
    p_web.SetValue('_bidv_',p_web.AddBrowseValue('<NetWebbrowse procedure name that called the NetWebForm>','<File Name>',<primary key of file>,p_web.GSV('<primary key value>')))   
    p_web.SetValue('<primary key field name>',p_web.GSV('<primary key value>'))
    p_web.RequestReferer = p_web.gsv('SaveRefer<NetWebForm procedure name>')
  end

Rob Kolanko

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #24 on: July 31, 2012, 06:13:16 AM »
two minor things I noticed;

p_web.SetValue('_bidv_',p_web.AddBrowseValue('<NetWebbrowse procedure name that called the NetWebForm>','<File Name>',<primary key of file>,p_web.GSV('<primary key field name>')))   
p_web.SetValue('<primary key field name>',p_web.GSV('<primary key field name>'))

other possible pressure points;

a)  if p_web.GetValue('_buttontext_') = p_web.translate('Save and Next')
Double check that the text on your "save and next" button is what you are testing for here.

b) The buttons (Save & Save and Next) are both of type SAVE. I think at some points in your testing you had them set as type BUTTON.

Keep us posted.
cheers
Bruce


Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #25 on: August 04, 2012, 03:12:39 PM »
Well, I got Save and Next on NetWebForm to work for my application, but I did number of variances to the method that Bruce had proposed in the web1 example. I documented the changes on the attached word file, SaveAndNext.doc.  When I get a chance, I will put these changes into the Web1 example . The reasons for the changes is that the second Save button was causing problems and it just was not working in my application.

Also I would like to report a bug. When program is used with the MSIE8 browser, the p_web.GetValue('_buttontext_') is returning  'undefined' for the “Save and Next” button. So right now,  I am also checking for 'undefined' text as if it was 'Save and Next' .  This is likely a bug in the NetTalk object because the p_web.WholeURL method returns the same text when used with  either MSIE8 or Firefox browsers.

Thank-you for your assistance,
Robert Kolanko

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #26 on: August 05, 2012, 11:34:28 PM »
I think I'd need an example to test the IE8 problem you're having Rob.

cheers
Bruce

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next button for NetWebForm
« Reply #27 on: August 06, 2012, 08:18:11 AM »
Attached is an example. I added a submit button to the MailboxesFormControl form of the Web1 example that we have been working with. This submit button links to the MailboxesFormControl via URL. I added a p_web._trace statment in the InitForm embed that shows the value returned from p_web.GetValue('_buttontext_') method. Use debug to see the results. When firefox is used, p_web.GetValue('_buttontext_') method  returns the button's text "Submit Button" when MSIE8 is used, the method returns "undefined".

Thanks for your assistance,
Robert Kolanko

[attachment deleted by admin]