Referencing a form field text value
Form Name = registration
Field Name = password (password attribute set)
Within the form "123" is input into the field named password
A function is accessed by onClick on the Submit button
After executing the following statement
msg = registration.password.value
msg is undefined.
However if I step through using the debugger msg will show a value of 123
The same occurs if I try to store registration.password.length in a variable
A couple of things to try...
First, define your variable msg somewhere outside the function.
In your header,
msg = "";
//your password validation code
If that doesn't work, try accessing the value this way...
msg = document.registration["password"].value
or <<<document.getElementsByName('password').value>>>. That should be more compatible and browser friendly.
Try alerting the contents of msg right after retrieving it. Alsom if it is a submit button, place the triggered function in an event-driven attribute, onSubmit, of the form.
<form onSubmit="whatever is in the onclick on the submit">
<input type="submit" onclick="do not put anything here">
should never get failed...
I mixed the brackets...:
Thank you chestertb, steelersfan88 and kor for trying to help me. It was much appreciated.
In hindsight, much to my chagrin, I may not have reported what turned out to be a critical piece of information.
Using FrontPage 2002
Form Name: registration
Field name: password
Specifying constraints within FP2002 on the field.
Another point which may be of interest. If you use, as was suggested, a function within onSubmit instead of onClick (on the Submit button) it MUST be called FrontPage_Form1_Validator
Finally while there may be other ways of doing it, because I wanted to add another check above those provided by FP validation I did the following:
1) Within the Form Field properties I set all my validation.
2) I published the page.
4) I then removed all the field vaildations with FP, pasted in the code it had generated when the validations were in place, added my additional code and then republished the page.
If any of this does not make sense or you want additional explanations please feel free to say so
eeeerrr... Front Page code lines are different of and are not standard DHTML or DOM code lines, so... You have to decide, or one or another... If Front Page, well... hm, you will have to find someone who work with..., not sure here are too many.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)