/    Sign up×
Community /Pin to ProfileBookmark

Hi,
I am trying to use this function to validate and I get an error because the name starts with an exclamation and has a space(which are required conventions for my shopping cart)
I tried quotation marks with no luck and have tried researching but cannot find a remedy. Any input is greatly appreciated.

function validatechoice(frmname){
if(frmname.!SKU0002 Flavor1.value==”None”){
alert( “Please choose a flavor”)
frmname.!SKU0002 Flavor1.focus()
return false
}
return true
}

……………………………..
<select name=”!SKU0002 Flavor1″>
<option selected value=”None”>Choose Flavor</option>
<option value=”BBQ”>BBQ</option>
<option value=”Honey BBQ”>Honey BBQ</option>
<option value=”Spicy BBQ”>Spicy BBQ</option>

</select>

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Apr 26.2003 — you should be able to use HTML entity value for exclaimation mark

&amp;excl;
Copy linkTweet thisAlerts:
@buzzbo55authorApr 26.2003 — Thanks,

I am still getting an error when I write it like this

function validatechoice(frmname){

if(frmname.&excl;SKU0002 Flavor1.value=="None"){

alert( "Please choose a flavor")

frmname.&excl;SKU0002 Flavor1.focus()

return false

}

return true

}?
Copy linkTweet thisAlerts:
@NedalsApr 26.2003 — I not 100% sure on this, but I do not think you can use '!' in a form name. Nor should your name contain a space. If you restrict your form names to alphanumeric chars, you will not run into problems.

Hope that helps!
Copy linkTweet thisAlerts:
@buzzbo55authorApr 26.2003 — Thanks,

Unfortunately it is part of the naming convention for my shopping cart they require that I put"!" before the sku and a space then a short description.

I tried to get help with their e-support and they don't feel that it's their job to teach me js so I'm trying to resolve it on my own.
Copy linkTweet thisAlerts:
@buzzbo55authorApr 26.2003 — Works great

Thanks for your time...I appreciate it!
Copy linkTweet thisAlerts:
@buzzbo55authorApr 26.2003 — Good Info, thanks again
×

Success!

Help @buzzbo55 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...