0

Here's my HTML:

 <input type='checkbox' name='PatientReady1' value='Yes' checked onClick="PatientReady ("PatientReady1","111","PatientReady")">

And my JavaScript:

function PatientReady(element, TriageNo, Field){
    debugger;
        if (element.checked == 1){
            new Ajax.Request (
                "PatientReady.asp",
                        {   
                        method: 'post',
                        parameters: {
                                    TriageNo: TriageNo,
                                    strReady: "Yes",
                                    strElement: Field
                                    },
                        asynchronous:false
                            }
                            
                        );
        }
        else{
            new Ajax.Request (
                "PatientReady.asp",
                        {   
                        method: 'post',
                        parameters: {
                                    TriageNo: TriageNo,
                                    strReady: "No",
                                    strElement: Field
                                    },
                        asynchronous:false
                            }
                            
                        );
        }
}

For some reason I'm getting a syntax error, when I click on the checkbox... I'm sure I'm missing some tiny stupid thing, perhaps a fresh set of eyes can help?

1
  • onclick="PatientReady ("PatientReady1","111","PatientReady")" - are those supposed to be single quotes in the function call? Commented Sep 1, 2009 at 18:52

4 Answers 4

1

As Mark mentioned, if you have double quotes around your string, inside the string should only be single-quotes. It doesn't matter which one you use, but try to be consistent, for readability purposes.

Sign up to request clarification or add additional context in comments.

Comments

1

Use apostrophe instead of quotation mark after onClick:

onClick="PatientReady('PatientReady1','111','PatientReady')"

Also checked should be:

checked="checked"

1 Comment

Just checked is fine and legal in HTML.
1

Try using this syntax:

<input type='checkbox' name='PatientReady1' value='Yes' checked onClick="PatientReady (this,'111','PatientReady')">

you want to use "this" to reference the actual object, if the funciton were using a 'getElementById' function call, then you would be good, but it's not

Comments

0

you have double quote both for delimiting and in your onclick event

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.