Making a Simple form

User 327365 Photo


Registered User
26 posts

I've made a simple form on my contact page, comprising of Name, Email, and a Textearea box, also 2 radio buttons and a submit button. If I click the radio buttons on my local preview screen, both buttons are actioned and I can't turn either one off again. How do I make it so that a user can only have one radio button highlighted at a time, not both.
Thanks
User 327365 Photo


Registered User
26 posts

Here's the HTML code:

<div class="coffee-span-6 column-17 coffee-286-span-12 coffee-377-span-12">
<form class="form-container form-container-1">
<label class="label label-1">Your Name</label><input value="" name="Input Name" type="text" class="input-name-contact">
<label class="label label-2-contact">Your Email Address</label><input value="" name="email-name" type="email" class="email-form-contact">
</form>
<label class="radio radio-button-1-contact">
<input type="radio" name="General Enquiry" value="General Enquiry"><span>General Enquiry</span>
</label>
<label class="radio radio-button-2-contact">
<input type="radio" name="Request Estimate" value="Request Estimate"><span>Get Estimate</span>
</label>
<label class="label label-3-contact">Enter your text here</label><textarea name="textarea-name" class="textarea-from-contact"></textarea>
<a class="link-button button-link-1" href="mailto:info@patzwebdesign.com">Submit</a>
</div>
User 187934 Photo


Senior Advisor
20,181 posts

Have each set of radio buttons that work together have the same group name. Also remove the space from the group name.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2147646 Photo


Registered User
233 posts

Half of your form is placed after </form> ;)

User 38401 Photo


Senior Advisor
10,951 posts

It's a lot simpler to mess with it in the program, don't mess with the code if you don't have to guys.

To make the Radio buttons not have a default choice, make them required. That will add a Choose One type of choice at the top and it will require them to make a choice. This also then makes "no" choice already chosen on the element.

That's all there is to it. :)
User 327365 Photo


Registered User
26 posts

Thanks for your help everyone, much appreciated.

I wish I'd noticed the </form> label was out of place,what a dozy mistake to make!
I'll go and fix everything and concentrate at the same time, I can multi task if I try hard. :D

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.