...

View Full Version : fValidate 5.01b Group Error Mode Problem..



arinbiorn
08-18-2004, 05:20 AM
Greetings All.

I'm encountering a problem with Peter Bailey's fValidate 5.01b (http://www.peterbailey.net/fValidate/)

Statement of the Problem: onSubmit produces:

A Runtime Error has occurred.
Line: 518
Error: 'undefined is null or not an object'

Environment:

Windows NT 4 SP6a
MSIE 6.0 SP1
fValidate: 5.01b (No mods to any of fValidate's files)

To Reproduce: Create a simple two field form (or use the one at the end of this post) and enable bConfirm, bDisable,
bDisableR and group error modes true with error notification mode of '24'
[i.e. onSubmit="return validateForm(this,1,1,1,1,24);] Open the file and fill-in both fields with valid information
and click "Submit".

Instead of the expected confirmation message (bConfirm is true), I get:

A Runtime Error has occurred.
Line: 518
Error: 'undefined is null or not an object'

The referenced code is in fValidate.core.js at:

var focusElem = ( typeof firstElem.fields != 'undefined' )?
firstElem.fields[0]:
firstElem;
this.selectFocus

If I make the change:

From: <FORM name="fValfrm" onSubmit="return validateForm(this,1,1,1,1,24);">
To: <FORM name="fValfrm" onSubmit="return validateForm(this,1,1,1,0,24);">

that disables Group Error mode, the confirmation message appears as expected.

Does anyone see any stupidity that I'm performing here and can point me in the right direction?

Thanks!

R. Damian Koziel


----------

<HTML>
<HEAD>
<STYLE>
input.errHilite, select.errHilite, textarea.errHilite {
border: 1px solid #DDC;
background-color: #FFE;
}
label.errHilite {
color: #C00;
}
ul#errors {
display: none;
margin-top: 1em;
background-color: #FFE;
border: 1px solid #CC9;
padding: .3em;
color: #C00;
font-weight: bold;
}
ul#errors li {
margin-top: .5em;
margin-bottom: .5em;
padding: 0;
}
ul#errors li.heading {
list-style-type: none;
color: #000;
font-weight: normal;
font-style: italic;
margin: .5em 0;
padding: 0;
}
</STYLE>

<script type="text/javascript" src="js/fValidate.config.js"></script>
<script type="text/javascript" src="js/fValidate.core.js"></script>
<script type="text/javascript" src="js/fValidate.lang-enUS.js"></script>
<script type="text/javascript" src="js/fValidate.validators.js"></script>

</HEAD>

<BODY>
<FORM name="fValfrm" onSubmit="return validateForm(this,1,1,1,0,24);">

<ul id="errors">
<li class="heading">Click the individual error message below to focus on
the element in error.</li>
</ul>

Your Name: <input type=text name="name" alt="alnum|3|x|0|1|-.,&" emsg="No
name." size="38">
<br>
<br>
Your E-Mail Address: <input type=text name="from" alt="email" emsg="No
e-mail address." size="38">
<br><br>

<input type="submit" value="Submit" name="Submit" />
<input type="reset" value="Reset" name="Reset" />
</FORM>
</BODY>
</HTML>

jamess
06-22-2005, 09:50 PM
Hello,

I did the following to get it to work on IE6 (and continue working with Firefox). Not tested on other browsers. Code may be improved easily by someone else, etc.

Find the code in the /* */ below in the fvalidate file and comment it as below and add the code found below the commented code.

/* var focusElem = ( typeof firstElem.fields != 'undefined' )?
firstElem.fields[0] :
firstElem;

this.selectFocus( focusElem );
*/
if ( (firstElem != null) && ( typeof firstElem.fields != 'undefined' ) ) {
alert(firstElem.fields[0]);
var focusElem = firstElem.fields[0];
this.selectFocus( focusElem );

}

if (firstElem != null) {
this.selectFocus( firstElem );
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum