I am using web2py to write a search engine like app. Is it possible to implement two submit button for one form such as google has two buttons “search” and “I am feeling lucky”. Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like this:
Giving a name to the “I’m feeling lucky” submit button causes its value to be submitted with the form, so you can check for its presence among the submitted variables and conditionally return a different response in that case.
Note, the
FORM()helper defaults to using the post method, but because this is a search form, the above uses the get method.You could also build the form manually in the view rather than using the
FORM()helper.