NetTalk Central

Author Topic: Validation on a memory based form? (4.29)  (Read 5271 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Validation on a memory based form? (4.29)
« on: September 20, 2007, 07:59:41 AM »
 ??? another problem with 4.29 (maybe) I can not validate a dropdown when the form is submitted.
I have a hand-filled dropdown with the first item as 'Select a Datatype' value=''
I want to validate DataType and not allow the form to complete if the Datatype is ''
I have this code -
ValidateRecord  Routine
  ! Start of "On Insert & Update : Form ends : before disk write"
  ! [Priority 5000]

  ! End of "On Insert & Update : Form ends : before disk write"
  p_web.DeleteSessionValue('Transfer_ChainTo')
  ! tab = 1
    loc:InvalidTab = 0
  ! formfield = DataType
  ! formfield = L_FileName
  ! Start of "On Insert & Update : Form ends : before disk write"
  ! [Priority 4000]
      If DataType = ''
        loc:Invalid = 'DataType'
        exit
      End
  ! End of "On Insert & Update : Form ends : before disk write"

This is killing me. I'd appreciate ANY kind of response.
Chris c
Real programmers use copy con newapp.exe

Graham

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Validation on a memory based form? (4.29)
« Reply #1 on: September 21, 2007, 12:39:01 AM »
Hi Chris,

Try:

   loc:alert = 'DataType cannot be blank'
   p_web.SetValue('retry','YOUR_FORM_NAME.htm')           ! Set form retry

hth
Graham

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Validation on a memory based form? (4.29)
« Reply #2 on: September 21, 2007, 05:40:41 AM »
Thanks, Graham. I didn't have the .ssv('retry','Transfer') set
BUT in placing messages at the top of each process and in the validate, I found that it sometimes skipped the validate altogether.
(Edit) - There is no loc:alert field anymore. I do remember having to deal with that before.
Is it gone in 4.29?
« Last Edit: September 21, 2007, 06:04:32 AM by ccordes »
Real programmers use copy con newapp.exe

Graham

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: Validation on a memory based form? (4.29)
« Reply #3 on: September 22, 2007, 10:48:38 PM »
Hi Chris,

I use the ValidateUpdate embed which works for me.  Check that your DataType field is set to required - Template prompts/Fields/Validate tab

As for loc:alert, it is still here (4.29)   Not sure why you don't have it?  Maybe recreating the form from scratch will solve the problem?

Cheers
Graham

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Validation on a memory based form? (4.29)
« Reply #4 on: September 24, 2007, 06:59:50 AM »
That's weird, I did a search for loc:alert using textpad on all the source in my project and could not find a single instance except for the one I had commented out.

Searching for alert, brings up a whole bunch of WinAlert statements and some javascript:alert things that I wrote to handle validation errors, but not loc:alert.

chris

BTW - I changed the embed where I setup the validation and have it working.
I realized that it was also a combination of the use of a drop down which was used in the validation of a file upload field. The file upload seems to fire off it's own code before finishing the form or something. If I leave the filename field blank, and click the submit button, it tries to copy the blank filename before validating the form. I put some validation in the handlefile method of the webhandler to keep it from crashing the server.
Real programmers use copy con newapp.exe