/    Sign up×
Community /Pin to ProfileBookmark

syntax error….where?

Ok background. I have a form built in PHP (it’s a new user request form that sends an e-mail to our help desk). I am trying to control what the user can select based upon the options that they pick. If anyone would like a further back ground on the form please let me know and i can dive into further details on the form.

so i have this code built in js:

[CODE]14: <script type=”text/javascript”>
15: function checkPC(){
16: if (document.form1.computer.value==” || document.form1.computer.value==’No’){
17: document.form1.thinClient.disabled=true;
18: document.form1.pc.disabled=true;
19: else
20: document.form.thinClient.disabled=false;
21: }
22: if (document.form1.thinClient.value==” || document.form1.thinClient.value==’Yes’){
23: document.form1.pc.disabled=true;
24: else
25: document.form1.pc.disabled=false;
26: }
27: if (document.all){
28: setInterval(“checkPC()”,100)
29: }
30: }
31: </script>[/CODE]

[B]I am returning a syntax error on line 19 char 1.[/B] Can someone please explain what it is that im doing wrong, I have modified this code from an online tutorial.

Thanks for any help or insight! ?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51May 25.2006 — well document.all is IE only, hope you are an IE shop

you are missing opening and closing brackets for your if statement

if(........){

.......

.......

[B]}[/B]

else[B]{[/B]

.........

}

Eric
Copy linkTweet thisAlerts:
@TheBearMayMay 25.2006 — Without altering things too much, it should be:
[code=php]
14: <script type="text/javascript">
15: function checkPC(){
16: if (document.form1.computer.value=='' || document.form1.computer.value=='No'){
17: document.form1.thinClient.disabled=true;
18: document.form1.pc.disabled=true;
19: } else {
20: document.form.thinClient.disabled=false;
21: }
22: if (document.form1.thinClient.value=='' || document.form1.thinClient.value=='Yes'){
23: document.form1.pc.disabled=true;
24: } else {
25: document.form1.pc.disabled=false;
26: }
27: if (document.all){
28: setInterval("checkPC()",100)
29: }
30: }
31: </script>[/code]

[size=-2] I see A1ien51 types a little faster...[/size]
Copy linkTweet thisAlerts:
@bimmerboy91authorMay 25.2006 — well document.all is IE only, hope you are an IE shop

you are missing opening and closing brackets for your if statement

if(........){

.......

.......

[B]}[/B]

else[B]{[/B]

.........

}

Eric[/QUOTE]


Yes...this is work for an intranet. So i have the privelage of developing for a single browser base. Let me see real quick if that is the cure.
Copy linkTweet thisAlerts:
@bimmerboy91authorMay 25.2006 — ok so that got rid of my syntax problem. Thanks for the quick responses guys.

i have simplified the code because the form is not enabling items when the value "Yes" is selected.

Here is the code as it stands now:

[CODE]<script type="text/javascript">
function checkComp(){
if (document.form1.computer.value=='Yes'){
document.form1.thinClient.disabled=false;
}
else{
document.form1.thinClient.disabled=true;
}
}
</script>[/CODE]


the above code is trying to say this: "if computer value equals Yes re-enable the thinClient radio button if it's not "Yes" leave it disabled"

Maybe i'm not calling the function right? The below code is what i have for the radio button. This button is part of a two(2) radio button group (value's being "Yes" and "No")

I have also tried the [code=php]onclick="checkComp();"[/code]

[code=php]<input type="radio" name="computer" value="Yes" onselect="checkComp();"/>[/code]
×

Success!

Help @bimmerboy91 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.2,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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