I have a form that opens in the dialog, one of the fields is autocomplete. All fields are created and the server values are stored in them to fill out the form.
var mydiv = jQuery ("#formform"); Var $ myform = jQuery ("form id = 'EditForm' method = 'post' action = 'index.php? Option = com_component and task = edit' & gt; & lt; / form & gt;"); ... var $ mylabel10 = jQuery (= 'edit' for label & gt; one label & lt; / label & gt; "); Var $ myinput9 = jQuery ("input id = 'choose edit' name = 'select edit' type = 'text' / & gt;"); Var $ mylabel9 = jQuery (= 'Edit Selection 2' & gt; Other labels for label & lt; / label & gt; "); Var $ myinput8 = jQuery ("& lt; input id = 'edit selection 2' name = 'add_path' value = '" + path + "' / & gt;"); // Path Server is a value passed from $ myform.append ($ $ mylabel10, $ myinput9, $ mylabel9, $ myinput8); Mydiv.append ($ MyForm); / / Autocomplete code-order autocomplete Dialog is available to exit [= label: 'foo', value: 'bar'}, {label: 'xyz', value: 'abc'}, ...]; JQuery ("#Edit Selection", MIDI) Auto complete ({source: available, focus: function}} {return false;}}) .on ('autocompletselect', function (e, ui) {var t = jQuery (this), description = jQuery ('# Edit '' Selection 2 '), label = (e.type ==' autocompleteresponse '? Ui.content [0] .label: ui.item.label), value = (e.type ==' autocompleteresponse '? Ui. Content [0] .value: ui.item.value); t.val (label); details.val (value); // does not update the form here? Return false;}); // Automatically get reference to the element auto autoComplete = jQuery ("# edit", mydiv). Autocomplete ("widget"); Var dialogOpts = {modal: true, autoOpen: true, resizable: false, width: 525, height: 'auto', title: 'edit settings'}; Mydiv.dialog (dialogOpts); AutoComplete.insertAfter (mydiv.parent ()); This is an autocomplete in the editing dialog, when it is selected, it should update the other input fields ( # EditSelect2 ). Currently # EditSet2 has the value from the server (variable path ). When a new value is chosen from autocomplete, then I hope the form will be updated due to this code: details.val (value); AutoComplete works now but the server does not get updated after selecting a new choice in the autocomplete value ( path ). Hope this is prudent.
There is a small syntax error in your myinput8 statement:
$ myinput8 = JQuery ("& lt; Input id = 'Edit Selection 2' name = 'add_path' value = '" + path + "/>;); should be:
$ myinput8 = jQuery ("& lt; input id = 'edit selection 2' name = 'add_path' value = ' "+ Path +" '/ / ";);); Finally focus on additional single quotes.
No comments:
Post a Comment