NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Devan on May 17, 2012, 03:01:14 PM

Title: Reading HIDDEN field values?
Post by: Devan on May 17, 2012, 03:01:14 PM
Hey all,

I have a NetWebForm with a couple of hidden fields, meaning INPUT TYPE="HIDDEN" for a couple of fields in my database.

These hidden fields get their VALUE changed by jQuery calls and actions elsewhere on the form.  I assumed that the new VALUEs would get picked up and stored in my database when the form is completed, but this doesn't seem to be the case.

When I inspect the HTML in the Developer console in Chrome, I can see that:

<input type="hidden" id="myfield" ... value="myval">

seems to get the VALUE updated in the DOM, but NetTalk is not picking it up.

How can I force NetTalk to 'read' these updates values when the form is saved?

Thanks!
Title: Re: Reading HIDDEN field values?
Post by: kevin plummer on May 17, 2012, 03:22:03 PM
sounds like you need to also save the values to the session Q so you can prime your DB fielods in the Validate record routine. I believe there is a javascript command to add to the session Q but I can't remember what it is.
Title: Re: Reading HIDDEN field values?
Post by: Devan on May 17, 2012, 05:19:08 PM
Yes, that is EXACTLY what I am trying to do Kevin! :)

If there was a nice, simple way to 'load' session variables from javascript then I would fall off my chair with glee! :D

Devan
Title: Re: Reading HIDDEN field values?
Post by: Bruce on May 17, 2012, 10:17:39 PM
Hi Devan,

so there are 2 questions here I think.
a) how to get JavaScript to update session values and
b) how to store values incoming from a form in the session queue.

I suspect you only need one, not both. First the answer to (b) though, since it's likely to be the one you don't use;

In the form, Validaterecord embed;
p_web.StoreValue('whatever')
where 'whatever' is the name of the (hidden) field being submitted.

however I suspect your hidden value thing is a kludge to get data from the browser? If so a simpler approach, in your JavaScript is just to call

SetSessionValue(name,value);

in JavaScript. (be aware, it's case sensitive.)

That JavaScript function (with the familiar name) will send an asynchronous packet to the server containing the name, and value, and the server will automatically move that into the session queue for you.

please don't hurt yourself falling off the chair...

Cheers
Bruce

Title: Re: Reading HIDDEN field values?
Post by: Bruce on May 17, 2012, 10:24:52 PM
Hi Devan,

so there are 2 questions here I think.
a) how to get JavaScript to update session values and
b) how to store values incoming from a form in the session queue.

I suspect you only need one, not both. First the answer to (b) though, since it's likely to be the one you don't use;

In the form, Validaterecord embed;
p_web.StoreValue('whatever')
where 'whatever' is the name of the (hidden) field being submitted.

however I suspect your hidden value thing is a kludge to get data from the browser? If so a simpler approach, in your JavaScript is just to call

SetSessionValue(name,value);

in JavaScript. (be aware, it's case sensitive.)

That JavaScript function (with the familiar name) will send an asynchronous packet to the server containing the name, and value, and the server will automatically move that into the session queue for you.

please don't hurt yourself falling off the chair...

Cheers
Bruce

Title: Re: Reading HIDDEN field values?
Post by: Devan on May 21, 2012, 05:41:12 PM
Ok, consider my butt to be quite sore now... !!  ;D

This is fantastic news to discover that there IS a Javascript procedure for loading session variables!  Wow, time for me to go refactor a whole bunch of code...

Thanks Bruce!
Devan