Dropdown Menu - Submit Automatically

By: Chris Titus | Asked: 02/04/2023
ForumsCategory: How-toDropdown Menu - Submit Automatically
Chris Titus asked 1 year ago

Is it possible to modify a dropdown menu in a submit form so it automatically submits the name when a dropdown item is selected ... and the Submit button doesn't need to be clicked?   Thank, Chris

1 Answers
Victor Font answered 1 year ago

Submit just the name field? If that the only field on the form or are their other fields and you want to automate a full form submit? You can programmatically trigger a submit using jQuery. I would bind the submit to the change event for the dropdown field. See this: https://www.w3schools.com/jquery/event_submit.asp

Chris Titus replied 1 year ago

Sorry, I'm not sure I described it correctly or with enough detail. I have a search form. In the search form is a dropdown menu w/ client names and a submit button. I'd like to remove the submit button and have the search execute when I select a client's name.

Victor Font replied 1 year ago

Yes, I understand exactly what you want to do. The guidance I gave you applies. You have to write custom jQuery to monitor the change event of the dropdown. When a name is selected, use the jQuery to trigger form.submit(). You can hide the submit button with CSS.

Chris Titus replied 1 year ago

I see. Thank you!

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community