NetTalk Central

Author Topic: Reading HIDDEN field values?  (Read 3871 times)

Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Reading HIDDEN field values?
« 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!

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Reading HIDDEN field values?
« Reply #1 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.

Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Re: Reading HIDDEN field values?
« Reply #2 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Reading HIDDEN field values?
« Reply #3 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


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Reading HIDDEN field values?
« Reply #4 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


Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Re: Reading HIDDEN field values?
« Reply #5 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