Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need your input on validation for those who turn off Javascrip 1

Status
Not open for further replies.

lizok

Programmer
Jan 11, 2001
82
US
Hello,
here is the situation:
we have an app. user fills in data on several sections. data is numeric. currently we have js page that runs validation on the pages. Some sections require cross validations with other sections. For example: Sec2Field1 must match Sec3Field3. and so on. Some users to avoid annoying error message, turn off javascrip and complete their data entry and submit it. the problem is that data entered is invalid bacause they bypassed those required validations. as far as i can see, javascript is the best way to do as user is informed instantly that invalid data is entered. The client we developed the app for mentioned that some institutions turn off javascript to avoid trojans and such. Can anyone advised on how to ensure that user submits valid data even if javascript is turned off. i thought about running serverside on Submit (end of data entry), but this maybe an overhead. any suggestions?
tahnk you
 
use coldfusion...

<!--- form handler --->
do your checks that you would have JS do.
<cfif all_checks_are_ok>
process form
<cfelse>
<cfset errorMsg = "your error message here">
</cfif>

<!--- your form here --->
<form action = "THISPAGE.cfm">
<cfif isdefined("errorMsg")><cfoutput>#errorMsg#</cfoutput></cfif>
<input type = "text" name = "Sec2Field1"><cfif isdefined("form.Sec2Field1")> value = "<cfoutput>#Sec2Field1#</cfoutput>"</cfif>>
...
...
...
</form>


We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
ok.
all_checks_are_ok being some sort of include template with validation functions?

we have some 40 fields on this form. and as many error messages that are unique for fields. Catching those on page submit would generate quite a large message. any way to display those in a nice way?
 
no, that's just psudo-code, all_checks_are_ok was just a variable.

you'd probably have to do a check for each field just like you do in js.

<cfset errorMsg = "">
<cfif fld1 neq fld2>
<cfset errorMsg = errorMsg & "fld1 must equal fld2<br>"
</cfif>
<cfif len(trim(fld3)) eq 0>
<cfset errorMsg = errorMsg & "fld3 is required<br>">
</cfif>
...
...
...
...


<cfoutput>#errorMsg#</cfoutput>
you could put it in a bulleted list or make the error display anyway you want.

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top