NetTalk Central

Author Topic: Checking Fields in a form  (Read 4420 times)

broche

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Email
Checking Fields in a form
« on: April 30, 2014, 11:14:50 AM »
NT 8.1
I have two fields on a form:
EditsRequired and EditsCompleted
I am trying to check one against the other when a check box is clicked with Immediate validation
I know the EditsRequired field = 1
But when I do a loc:alert it shows 0, even though the field is right there on the form.
Must be missing something here?

IF CVF:EditsCompleted => CVF:EditsRequired

Brian
Brian

debzidoodle

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #1 on: April 30, 2014, 11:33:36 AM »
Hi Brian

Try it like this
p_web.gsv('CVF:EditsCompleted') => p_web.gsv('CVF:EditsRequired')

Debra

broche

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #2 on: April 30, 2014, 12:48:21 PM »
Thanks Debra,
I sort of did it like that afterwards by doing the following which worked.
        IF CVF:EditCommitt = 'Y'
            Loc:EditsReq = p_web.GSV('CVF:EditsRequired')
            Loc:EditsCompl = p_web.GSV('CVF:EditsCompleted')
            DO CheckCounts
        END       

CheckCounts is a routine which does a lot and call other routines
Now the issue is getting the value in loc:EditsCompl back into CVF:EditsCompleted
I presume I use SetSessionValue something like

p_web.SetSessionValue('CVF:EditsCompleted','EditsCompl')

But this does not seem to work?

Brian


Brian

broche

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #3 on: April 30, 2014, 01:41:35 PM »
OK - I am confused as to what happens when

I have two routines in this same form which calculate the value of the document and the rates paid.
I have some logic in the same field as discussed that calls those routines
They get called OK but the form data does not get updated
When I call the routines from the PreUpdate embed after 1 start the routines work great, I also notice that this embed gets called as soon as the form is opened, so maybe I am using the wrong embed. 
I am not using GSV etc. in this routine.

If I sound confused - I am :)

Brian.
Brian

Alberto

  • Hero Member
  • *****
  • Posts: 1871
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Checking Fields in a form
« Reply #4 on: April 30, 2014, 03:44:34 PM »
Do you reset the field you need after calculations? (Server Side Tab)
-----------
Regards
Alberto

Keith

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #5 on: April 30, 2014, 05:14:30 PM »
Hi Brian

Once the Form and the values are displayed in the browser the connection with the server is broken and there is no rememberance on the server of status or values.

When the user completes a field and the value has been sent to the server the NT validation routine will place the value of that field into the file field so that in any 'server side code' you have access fo the file field and can include it in tests and computations.  However, none of the other file fields are initialised until you code something like CVF:EditsRequired = p_web.GSV('CVF:EditsRequired') which moves the current value of the session variable into the field.

So if you are performing lots of calculations as part of the immediate code then for every field you are using you need the equivalent of the GSV above.  There are also two commands that are useful in this context:

p_web.SessionQueueToFile(file) which primes a record buffer with contents from the session data queue  and
 p_web.FileToSessionQueue(file) which copies an entire file record buffer to the session data queue.

These are documented in Capesoft's 'Building Web Applications with NetTalk' book.

Cheers

Keith
Clarion 10.0.0 build 12799
NetTalk 9.31
StringTheory 2.65
InsightGraphing 2.27

debzidoodle

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #6 on: April 30, 2014, 05:21:22 PM »
Quote
p_web.SetSessionValue('CVF:EditsCompleted','EditsCompl')

But this does not seem to work?

You almost have it right, try it like this (notice no quotes in the second part)

Code: [Select]
p_web.SetSessionValue('CVF:EditsCompleted',EditsCompl)
So after you fix that, do what michelis said and make sure the items on the screen you want refreshed are listed in the "Reset" list.  Find this right under your check box to "Send new value to server" where you enter your code.



broche

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Email
Re: Checking Fields in a form
« Reply #7 on: May 01, 2014, 08:22:16 AM »
Bruce's Webinar on May 1st answered a bunch of stuff relating to this issue.
Thanks Bruce.
Brian