How can I implement facebook @mention like tagging feature in a web2py application. I have to find user names written after "@" in a text form and give suggestions based on what user has typed till then.
2 Answers
You will need a lot of code for that. Client side you need javascript to help you on the event of pressing an @ in the given text field and showing a dropdown in the appropriate place. Except for jquery, web2py doesn't come with libraries to handle such a task specifically. (web2py offers automatic autocomplete in forms, but then the entire field is autocomplete). On the serverside it's quite easy to query the userdatabase and provide a json response to fill the autocomplete input on the client side.
My advise: search for a javascript mention library that supports this and create the serverside part in web2py.

- 435
- 3
- 10
Hope your project goes well Okay comming to the logic part of the code First using the ajax call back on 'onkeyup' function and passing the whole text to the controller to a function and then parse it and check whether it has @ using regex and then parse the later part of the @ part (using regex)and search for the users with that username(part of user name) using like function of DAL and return the results to view and display them in a hided div by unhidng it when you get the results back.

- 358
- 1
- 3
- 18