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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User-defined attributes/properities for the <input> tag????

Status
Not open for further replies.

Sharla

Programmer
Oct 12, 2000
2
US
Hi,

I am somewhat new to developing web pages. My situation is this: I am working on a site that includes a form submission. The only validation done is client-side with an external javascript file. The validation is only to check if required fields are blank. Well, the validation works when the form is sumbitted in IE but not Netscape (using version 4 of both). IE will produce an error and alert me to which required fields I missed, Netscape will submit the form as if no validation is has done.

Here is how the validation is done (This validation is used in a similar site that I was told to followed the design of):

First of all, each form element which is required includes an attribute call &quot;validType&quot; which is set to &quot;notBlank&quot;. ex. <input type=&quot;Text&quot; name=&quot;address&quot; label=&quot;Address&quot; size=&quot;30&quot; validType=&quot;notBlank&quot;>

Next, on submission of the form, a javascript function is called which loops through each element of the form and checks to see if &quot;validType&quot; is equal to &quot;notBlank&quot;.

Finally, here is my question: I have searched through as much html, dhtml, javascript documentation as I can stand, and I cannot find reference to an attribute called &quot;validType&quot;. I have come to the conclusion that this is user-defined. But I can't even find any documentation on user-defined attributes to determine if this is my browser compatibility problem. Does anyone know anything about creating your own attributes and what browsers recognize this.

Sorry if this is long and winded. Thanks in advance for your help.

Sharla

[sig][/sig]
 
Just a thought but since the object models in the two browsers are different is there a difference in the way you have to loop through to check each of the form elements. I have not done much javascript yet and no validation things so I am unsure if this makes a difference, but maybe.... [sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]
 
You have come across a great feature of javascript: the fact that it's object-oriented means that you can add user-defined properties to document objects--as long as the browser exposes those objects to scripting. Unfortunately Netscape currently does not expose all HTML elements of a document to scripting the way IE 4 or 5 do.

For Netscape, you should probably look for another way to validate your data. Here are some good pages to check out:
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top