hi i have a select(dropdown button) which displays various chioce for the user to select .. i want to validate it that if the user does not select any choice i should not able to do any action how to do. Is there any like required available for text box in html
hiiiiii@
0
Junior Poster in Training
Recommended Answers
Jump to PostHi,
You can use the
required
attribute:<form method="post" action=""> <label for="fruits">Choose an option:</label> <select name="fruits" required> <option value="">------</option> <option value="fujiapple">Apple</option> <option value="vanillaorange">Orange</option> <option value="pandoracherry">Cherries</option> </select> <input type="submit" name="submit" value="submit" /> </form>
By adding an empty option the form will not be submitted. You could …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.