I'm creating a dialog, below, to receive a name to publish something under. On the third line I initialize the input field to the last name used. The problem is, if I enter a new value and click Publish, when the Publish function reads the value of the field it always gets this preset value again,rather than the new value entered. Does anyone see a problem? Thanks.
publish_dialog$ = $('<div></div>').appendTo('body')
.html("<div><h6>Publish as . . .</h6><input id='publish_name' type='text'></div>");
$('input#publish_name').val(g.last_publish_name);
publish_dialog$.dialog({
modal: true, title: 'Publish as . . .', zIndex: 10000, autoOpen: true,
width: 'auto', resizable: false,
buttons: {
Publish: function () {
g.last_publish_name = $("#publish_name").val(); // get value entered
publishPage(g.last_publish_name);
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
},
});