Hi folks,

I have a form containing, amongst other things, a hidden input element (id=sAction) with its value set to "add" when the page first loads.

By clicking an item on an accompanying list (to call fnEditThisAsset), data from that item are loaded into the form and sAction's value is changed to "edit" using ('#sAction').val("edit")

However, if I click a toggle function, to bring the form back to a sAction="add" status, the ('#sAction').val("add") doesn't work as I hoped/expected - the value of sAction is set to nothing. All the other "requests" asked of the fnToggleAsset function are completed successfully.

The code is below...

function fnEditThisAsset(a,b){
    $("#theIndicator3").show();
$.get("scripts/ajax_ramosus_editor.asp?id=3&iAssetID="+a+"&nodeID="+b, function(responseText){
        try {
            var data={};
            eval("data="+responseText);
            $('#asset_editor').deserialize(data);
$("#asset_form").highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'}).find("legend").html('Edit asset <a href="#" onclick="fnToggleAsset();" title="Toggle to add an asset"><img src="images/r_toggle.gif" width="16" height="16" alt="Toggle to add an asset" class="clearbits" /></a>');
            $("#sAction").val("edit");
            $("#theIndicator3").hide();
        } catch(e) {
            $("#asset_error").html("Error in JSON response: "+e);
            $("#theIndicator3").hide();
        }
    });
}
function fnToggleAsset(){
    $.get("scripts/resetRamosusAssets.txt", function(responseText){
        try {
            var data={};
            eval("data="+responseText);
$("#asset_form").highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'});
            $("#sAction").val("add");
            $("#asset_label").html('Add asset');
            $("#asset_editor").deserialize(data);
        } catch(e) {
            $("#asset_error").html("Error in JSON response: "+e);
            $("#theIndicator3").hide();
        }
    });
}


Where am I going wrong?  What don't I understand?

Thanks,

Bruce 
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to