NetTalk Central

Author Topic: Refresh of NetWebSource on Form  (Read 2773 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 339
    • View Profile
    • Email
Refresh of NetWebSource on Form
« on: April 11, 2018, 01:13:32 AM »
Hi,

I have a memory form with parameter entry fields, a button (refresh_btn) and a NetWebSource procedure (calc_string)
The NetWebSource procedure creates an HTML string.

Should function like a Quote page,
the user completes the parameter fields and clicks the refresh button which should update the HTML result string being displayed at the bottom of the form.
I have added the calc_string procedure to the fresh list of the button
If I refresh the page it works, if I click the button it does not
The NetWebsource is not called.

If I switch the "send new value to server" on, it fires the NetWebSource procedure but does not display the updated html string on the form.

Am I missing a setting or am I using a NetWebSource procedure incorrectly?
Are there any examples that demonstrate this type of function?


thanks

Johan



bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Refresh of NetWebSource on Form
« Reply #1 on: April 11, 2018, 01:54:49 AM »
Hi Johan,

Its a bit tricky to see how you are going about this, but from what you've explained so far i'd have done it slightly differently. This is the process i'd follow:

1. Create normal source procedure that generates quote (if it needs access to p_web (session values), either pass it as a parameter or pass the Session values it needs to do its job), return the quote as a string.

2. On the screen that needs the quote, create a display field. On the [Display] tab put your function call that generates the quote into the Display field. Each time its refreshed it will call your function and generate your quote.

3. Add your button and tell it to refresh the display field.


A NetWebSource procedure, is basically a source procedure, but it has its own p_web and packet system. I use them when i need to create my own significant functionality, Bruce gives us things like NetWebForm and NetWebBrowse, I look at NetWebSource as the base we can use for other significant things like that. For example I have an image gallery which supports drag and drop to reorder photos. I build it with a NetWebSource procedure.


All that being said, its likely that the reason your approach didn't work is your generated quote html may not be XHTML compliant, which means it will fail to update the screen, but if you reload the screen it will show. To be XHTML compliant it needs to escape certain characters like & needs to be & etc. I think from memory p_web._JSOK() will encode it for you.

Regards
Bill



« Last Edit: April 11, 2018, 01:58:21 AM by bshields »

JohanR

  • Sr. Member
  • ****
  • Posts: 339
    • View Profile
    • Email
Re: Refresh of NetWebSource on Form
« Reply #2 on: April 11, 2018, 02:22:24 AM »

Hi Bill

Thanks for that advice and tip.

Will make some changes and see how it goes.


thanks

Johan