/    Sign up×
Community /Pin to ProfileBookmark

Values not getting passed in IE

I’m doing validation on submit and it doesnt seem to be working with IE 7. Can anyone offer some insight, here is a slimed down copy of my code:

[CODE]
function validate()
{
if(document.form.rotation.value==””)
{
alert(“You must enter a value for Rotation”);
return false
}
else
{
return true
}
}

<form method=’POST’ name=form action=’index.php?pageload=calllog&action=submit’ onSubmit=’return validate()’>3
<input type=text name=rotation>
<input type=submit>
</form>
[/CODE]

Clearly, this is really slimmed down, but I’m sure you can get the gist. If I just do a simple:

alert(document.form.rotation.value);

on submit it doesn’t display any value either. I should mention that this works great in Firefox.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@WebnerdOct 08.2007 — You should really quote your attributes completely. And, it all depends on the context of your code. Are there many forms on the page? Are your tags improperly nested? Have you validate your code? Try not to use the name "form" for a form as you will really confuse yourself later on.
Copy linkTweet thisAlerts:
@Doc_ThirstauthorOct 08.2007 — You should really quote your attributes completely. And, it all depends on the context of your code. Are there many forms on the page? Are your tags improperly nested? Have you validate your code? Try not to use the name "form" for a form as you will really confuse yourself later on.[/QUOTE]

Forgive my lack of knowledge. I'm pretty JS dense, its not my language of choice, and rarely use it.

I'll google your suggestions and see what I can find.

Edited for grammer.
Copy linkTweet thisAlerts:
@WebnerdOct 08.2007 — I'm just trying to cover the obvious items. Posting the full code would help a lot better.
Copy linkTweet thisAlerts:
@Doc_ThirstauthorOct 08.2007 — Seems to be an issue with select statements. My code example didn't show this, so it would have been impossible to really trouble shoot.

If you are passing a value for a select statement, IE does not assume that the label is the value.

<option>Atlanta

is not the same as

<option value=Atlanta>Atlanta

Easy, dumb mistake. Sorry for the forum space!
×

Success!

Help @Doc_Thirst spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...