Sunday, March 29, 2009

Re: getSelectionId error

this is the generated code by using ajax->autoComplete():

<input name="data[Contact][lastname]" type="text" id="ContactLastname"
autocomplete="off" value="" />
<div id="ContactLastname_autoComplete" class="auto_complete"></div>
<script type="text/javascript">
//<![CDATA[
new Ajax.Autocompleter('ContactLastname',
'ContactLastname_autoComplete', '/.../contacts/autoCompleteByName',
{afterUpdateElement:getSelectionId});
//]]>
</script>

and here is my getSelectionId function, which comes right after the
code above:

<script type="text/javascript">
function getSelectionId(text, li) {
alert (li.id);
document.getElementById('ContactLastname').value=li.id;
}
</script>

thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: