开发者

Ajax Autocomplete field: display one value, but use another?

I've got an autocompleter in a CakePHP app that provides a dropdown list of neighborhoods to attach to a place. I'm pulling from a table 'neighborhoods' with name and id fields. I want the user to see the name of the neighborhood,开发者_如何转开发 and I want the app to see the id of the neighborhood and insert it into the places table. How can I make this happen?


Another way of doing this would be to storing the id. Then when a user presses submit you replace the input field's value with your stored value.


assign the correct (hidden) value to a hidden input field


This type of functionality is normally achieved with a combobox, which is like an autocomplete, with an underlying select elememt, see here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜