NetTalk Central

Author Topic: Use NetWebSource in a form  (Read 9277 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Use NetWebSource in a form
« on: July 12, 2009, 09:57:28 PM »
Hi,
I want to embed HTML, produced by a NetWebSource into a Form.
What I have done is:
  • Create a web form.
  • Insert a browse (but in fact is is just some other HTML stuff, generated by my NetWebSource, but certainly not a browse).
  • Run it.
Is this a/the proper way to do it or is there a more efficient way to do it??

Kind regards,
René
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #1 on: July 13, 2009, 09:58:06 PM »
Hi Rene

This is perfectly within the design of how i's supposed to fit together, so carry on.
I recommend wrapping the code in the netWebSource in a <DIV></DIV> block, either manually or by using the template setting.

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #2 on: July 13, 2009, 11:57:43 PM »
Thanks Bruce,

Maby it's a good idea to use the term Web-procedure in stead of Browse, in the droplist.???

Cheers,
Rene
Rene Simons
NT14.14

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #3 on: July 14, 2009, 01:36:41 PM »
Bruce,

By the way. I did it as I described. Nothing happens.
It seems that the procedure doesn't even execute.
I placed a p_web.trace('blabla') in the processed codes.
But de debugviewer shows nothing.

Rene
Rene Simons
NT14.14

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #4 on: July 14, 2009, 02:07:52 PM »
Bruce,
Fixed it.
I used NetWebPage iso NetWebSource
Thanks,
Rene
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #5 on: July 15, 2009, 12:08:23 AM »
yes Rene, Web-Procedure would be inaccurate in the other direction because you can't use a NetWebForm or NetWebPage embedded onto a browse. Only a NetWebSource.

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #6 on: July 16, 2009, 07:46:09 AM »
Bruce,
Suppose I want to "refresh"tyhe content which is generated by my NetWebSource. E.g. after I use a button.
How would I do that?
Rene
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #7 on: July 16, 2009, 09:12:29 PM »
Hi Rene,

it depends a bit on the button, but assuming it is a "Button" and not a submit, and that the button is _not_ got a URL attached to it then;

a) make sure the netwebsource has the "Ajax Div" option turned on and
b) in the "server side code" for the button just call the netwebsource procedure.

cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #8 on: July 17, 2009, 10:16:54 AM »
Thanks Bruce,

Do I call the netwebsource procedure like:

packet = clip(packet) & '<!-- Net:kalender3 --><13,10>'
do sendPacket

in the server side code
Isn't it easier to give the procedure an equate and add this one to the reset-list? Or is this a stupid remark?

and

Do I place the button in the form??
Whar value do I give the timer??

Rene
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #9 on: July 20, 2009, 01:27:25 AM »
no, you call it as

kalender3(p_web)

> Do I place the button in the form??
yes

> What value do I give the timer??
0

Cheers
Bruce


Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #10 on: July 20, 2009, 09:50:11 PM »
Hi Bruce,
I followed your instructions but nothing happens.
The server side code is executed however.
I can tell by the fact that a specific sessionvalue (startdate) has changed.

When I go to a different menu-option, and then go back to the specific page, the calender-offset date has changed according to the button I have clicked before I left the page.

Later I tried to assign an equate to the procedure (like you do with a browse) and reset that one after the server side code is executed but that also didn't work.

Cheers,
Rene
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #11 on: July 20, 2009, 11:47:35 PM »
perhaps you can make a small example and post it here Rene?

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #12 on: July 21, 2009, 02:12:31 AM »
I will. Tonight.
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Use NetWebSource in a form
« Reply #13 on: July 21, 2009, 11:50:41 PM »
There were 3 mistakes in the example app, but one of them is my fault, and another is a lack of docs, so I'll post the results here;

a) First Rene's mistake so I don't feel too bad;
You coded a routine (getMaandNaam) inside the Processed Code embed. this prevented the normal procedure end to take place (p_web._DivFooter etc.) Move this routine to the Procedure Routines embed with the other routines.

b) As you are aware the code inside the source must generate xHTML - ie it must be XML compliant HTML. And it was (almost). The one mistake you did make was to use &nbsp; which is good in HTML but not allowed in XML. In the procedure I've created a string for you (ie the template does this) called NBSP. This contains &#160; which is html and xhtml compliant.

c) lastly, my error. Since you are embedding the source on the form, as a form field, it becomes a child of that form. So when you call it from the form you need to set the Parent value. Specifically;
  p_web.SetValue('_ParentProc','exampleform')
  kalender3(p_web)
  p_web.SetValue('_ParentProc','')

the last line probably isn't necessary for your app, but might be a good habit to get into so that code after the call is unaffected by the call.

Note that this is one of the rare cases where we're using SetValue rather than SetSessionValue. This is because we're passing a "parameter" to the NetWebSource rather than setting a setting for the NetWebSource to use. You're correctly setting, and using, QDL:StartDatum as a SessionValue not a Value.

Cheers
Bruce

« Last Edit: August 05, 2009, 09:02:09 PM by Bruce »

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Use NetWebSource in a form
« Reply #14 on: July 22, 2009, 12:29:26 AM »
Thanks Bruce,
I stand corrected  :D
This was a very usefull post I think.
Rene
Rene Simons
NT14.14