/    Sign up×
Community /Pin to ProfileBookmark

Confused with _ versus –

Hi… I’m new to JS, so forgive me if my question is too elementary. We have an order form and we have to use CHECK BOXES, rather than radio buttons to select a product (long story). Now, we only want them to select ONE check box. If they select a second check box, an error will show.

Without copy/pasting multiple scripts as to what works and what doesn’t, here are two pages.

[COLOR=”SeaGreen”]Works:[/COLOR] [url]http://www.hflsolutions.com//order/uc/ssi/yes.php[/url]

[COLOR=”Red”]Does NOT work:[/COLOR] [url]http://www.hflsolutions.com//order/uc/ssi/no.php[/url]

Now, if you look at the code, the ONLY differences are the following:

WORKS: PV_C and PV_3
NOT Work: PV-C and PV-3

I changed the underscore (which DID work) to a dash (which does NOT work).

Can anyone please help me? Any suggestions? Wasted an hour goofing around with it and nothing works =(

Thank you kindly in advance for your help…
– Sam

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERMay 08.2009 — ...

Can anyone please help me? Any suggestions? Wasted an hour goofing around with it and nothing works =(

...[/QUOTE]


I'm confused ... what is your question? ?

You say you have some working code and some non-working code...

get rid of what you say doesn't work and use what does!!! :eek:

How do you want it to work that is not correct currently in your working code?
Copy linkTweet thisAlerts:
@ZeroKilledMay 08.2009 — i guess DrSam concern is why the code doesn't work when the underscore is changed to a dash. if so, a dash have special meaning in javascript. it is a minus operator. so, javascript interpret it as subtracting variable PV with C or PV less 3. as you can see a dash can't conform on [url=http://www.geekpedia.com/tutorial6_JavaScript-identifiers.html]identifier[/url] naming.
Copy linkTweet thisAlerts:
@DrSamauthorMay 08.2009 — i guess DrSam concern is why the code doesn't work when the underscore is changed to a dash. if so, a dash have special meaning in javascript. it is a minus operator. so, javascript interpret it as subtracting variable PV with C or PV less 3. as you can see a dash can't conform on [url=http://www.geekpedia.com/tutorial6_JavaScript-identifiers.html]identifier[/url] naming.[/QUOTE]

Yes, this is correct. My sincere apologies for not making myself more clear in my original post. Sorry...

I gave both links to show (by viewing the source code) that the one with underscore DOES work and the one with the dash doesn't.

So, based on what ZeroKilled has said - I guess there is no work around the script, since it does act as a minus?.....

thank you again for your help. ?
Copy linkTweet thisAlerts:
@ZeroKilledMay 08.2009 — there is no workaround. identifiers, or variable naming, have rules. read the articles to learn more about it.

https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Variables

http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm
Copy linkTweet thisAlerts:
@DrSamauthorMay 08.2009 — Thank you again for your assistance, I really appreciate it!... ?
×

Success!

Help @DrSam 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.18,
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,
)...