Skip to main content

Search and Top Navigation

#4406 closed bug (notabug)

Opened March 26, 2009 02:54PM UTC

Closed March 27, 2009 11:35PM UTC

Last modified October 11, 2012 09:15PM UTC

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:

The 2nd click scenario will print out the following:

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");

}

}

Attachments (0)
Change History (2)

Changed March 27, 2009 11:35PM UTC by scottgonzalez comment:1

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.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted