Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4406 closed bug (notabug)

Anonymous function keeping previous value of a variable (IE.7)

Reported by: ryu Owned by:
Priority: minor Milestone:
Component: ui.dialog Version: 1.7.1
Keywords: Anonymous Function, storing old value, IE7, dialog box Cc:
Blocked by: Blocking:

Description

The issue here is that the anonymous function in the dialog invocation is storing the previous value of a variable named "DestinationObjID".

The 1st click scenario will print out the following:

  • "Value outside: ValueOne"
  • "Value inside: ValueOne"

The 2nd click scenario will print out the following:

  • "Value outside: ValueTwo"
  • "Value inside: ValueOne"
HTML ======

1st click: <INPUT TYPE="button" VALUE="Load" onClick="doPopup_Select('<SELECT>', 'ValueOne')">

2nd click: <INPUT TYPE="button" VALUE="Load" onClick="doPopup_Select('<SELECT>', 'ValueTwo')">

JAVASCRIPT

function doPopup_Select(strVal, DestinationObjID){

alert("Value outside: "+DestinationObjID); if(strVal == "<SELECT>"){

$('#selectionDialogBox').dialog({

title: 'Please make a selection', modal: true, buttons:{ "Ok": function() {

var objectVal = $("#selectable").val(); alert("Value inside: "+DestinationObjID); $('#'+DestinationObjID).val(objectVal); $(this).dialog("close");

}}

}); $('#selectionDialogBox').dialog("open");

}

}

Change History (2)

comment:1 Changed 11 years ago by Scott González

Resolution: invalid
Status: newclosed

That dialog is only initialized once, so on the second call you're not creating a second dialog, you're just displaying the first.

comment:2 Changed 8 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.