Hello all,

I'd appreciate some help in identifying where I'm failing with the following code/scenario.

I have a page that lists the questions in a multiple-choice type quiz and has, hidden, the form that I use to edit each question. When the appropriate link for a question is clicked, the editAQuestion function fires to bring back a json string containing the question and the multiple choice options and populates the existing form.

This works fine first time up - when the link for say, question 1, is clicked, the form is correctly populated. However, when another question is clicked, the form is not updated (the contents of the first question remain), despite the json string being returned with the correct data.

An abbreviated form of editAQuestion is below - in this one I'm just showing the code for updating the question text of the textarea element for sQuestion - the problem is the same.

I've tried erasing the content of the input fields in the form before repopulating, but this also has been unsuccessful. It's as though the elements are invisible second time around - and while I suspect this is a clue, it has not yet found fertile ground in my head.

The form elements lie within a div (#aqs) which remains "in existence" as evidenced by its correct response to the .slideDown and .highlightFade instructions in the code when the content fails to update.


function editAQuestion(lid){
    $.log(lid)
    $("#theIndicator4").show();$("#links_msg").hide();
$.get("scripts/ajax_ramosus_editor.asp?id=12h&info=" + lid, function(responseText){
        try {
            var data={};
            eval("data="+responseText);
            $("#theIndicator4").hide();
            var sYesNo=data.yesno;
            switch(sYesNo) {
            case "Y":
                //$('#nlink_form [EMAIL PROTECTED]"text"]').val("");
                $('[EMAIL PROTECTED]').val("");
                //$.log(data.sQuestion);
                $("#sQuestion").html(data.sQuestion);
                
$("#aqs").slideDown("slow").highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'});
                $("#cqs").slideUp("slow");
                break;
            case "N":
                
$("#cqs").highlightFade({color:'red',speed:2000,iterator:'sinusoidal'}).find("#links_msg").html(sMsg);
            }
} catch(e) {$("#cqs").highlightFade({color:'blue',speed:2000,iterator:'sinusoidal'}).find("#links_msg").html("Error in JSON response: "+e).show();
        }
    });
}

Thanks for your help,

Bruce 
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to