Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Validation not working consistently
ThrashCardiom
Junior Member

Posts: 4
Registered: 8/2/2007
Member Is Offline
posted on 8/3/2007 at 06:35 PM
Validation not working consistently


I have several forms that I am using the Form Validator on but I cannot get it to work consistently. One form has four fields on it and validates correctly. I have two forms with one field each to be validated and it doesn't work at all.

All the forms are generated from a database using the same perl function and I can't see any point of difference. The code for one that doesn't work is as follows (without complete HTML tags):

form name="Provider" action="http://xxx.xxx.xxx.xxx/cgi-bin/addcpd.cgi" method="post"

td class="heading" valign="top" width="25%" id="f_400">Provider Name</

td class="field"><input type="text" name="ProviderName" id="400" size="50" maxlength="" value="" ></td

script>
var a_fields = { 'ProviderName': { 'l':'Provider Name', 'r':'true', 'f':'alpha', 't':'f_400'}
},

o_config = {
'to_disable': ['Submit','Reset'],
'alert' : 1 + 4
}
var v = new validator('Provider',a_fields, o_config);
</script

input type="submit" name="Submit" value="Submit"
input type="reset" name="Reset" value="Reset"

Can anyone see what I am doing wrong?

Thanks
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 8/4/2007 at 05:07 PM

when it doesn't work what do you get? error by the validator? JavaScript error in browser? form submits without validation?

PS: just in case I'd avoid numeric IDs such as id="400"
View User's Profile View All Posts By User U2U Member
ThrashCardiom
Junior Member

Posts: 4
Registered: 8/2/2007
Member Is Offline
posted on 8/6/2007 at 03:41 PM

The form gets submitted without validation.

Avoiding numeric ids would be a problem as the form information is pulled from a DB and the id is a key used in other aspects of the program.
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 8/6/2007 at 04:24 PM

There must be some error message that you miss because of the page reload. Try to run v.exec() outside of the onsubmit (i.e. temporarily add another button and run v.exec() on its onclick)

re. IDs. Just add something in front of number i.e. id="e400"
View User's Profile View All Posts By User U2U Member
ThrashCardiom
Junior Member

Posts: 4
Registered: 8/2/2007
Member Is Offline
posted on 8/6/2007 at 04:58 PM

Interesting. The validation works. It would appear that the validation routine is not being called when the form is submitted.
View User's Profile View All Posts By User U2U Member
ThrashCardiom
Junior Member

Posts: 4
Registered: 8/2/2007
Member Is Offline
posted on 8/6/2007 at 05:05 PM

Found the problem. Fairly stupid really. I failed to put the onsubmit="return v.exec() line into the javascript field for the form in the database.

Thanks
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Free Download Free Download
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004