Extract the value from type field autocomplete
Extract the value from type field autocomplete
i have field type autocomplete and another field type select
When i select one option from field type select i can extract the value selected with the code :
var colonneoption = $('select option:selected', editorModifyAttribut.node('colonne')).text();
but if i try the same code with the field type autocomplete it doesn't work the variable is empty
var colonneautocomplte = $('select option:selected', editorModifyAttribut.node('colonneautocomplete')).text();
i know the logic off the form is good because when i check all the values sended to the sever by the form i see the good value for this field but i need to check something before to send to the server.
Could tell me which syntaxe i can use to extact the good value ?
Thank you for your help
Michel
Answers
I find jQuery UI AutoComplete really difficult to work with for labels and values!
This SO thread shows how you can listen for the
autocompleteselect
event to get both the label and value.Allan
hi allan,
sorry but it doesn't work.
I think i dont use the right event or syntaxe.
Below the description of the field colonneauto:
what is the good syntaxe to intercept the event when something change on the field and when is selected
when the field is a type select the syntaxe is :
$('select option:selected', editorModifyAttribut.node('colonne')).text();
and it works !!!
what is the equivalent for the field colonneauto because witw the syntaxe below
$('select option:selected', editorModifyAttribut.node('colonneauto')).text();
it doesn't work
thank you for your help
Try using
val()
rather thantext()
, and see if that does the trick,Colin
hi colin,
sorry no change always nothing
it is the same problem and about this subject the event triggereg for the field select with the syntaxe :
works !!
but the same syntaxe with field autocomplete
doesn't work too
hi allan and colin,
i found the solution .
Thank you for your help.
Michel
Hi Michel,
Great to hear you got it working. Could you let us know the answer in case anyone else finds this thread and is wondering the same thing?
Thanks,
Allan