Home › Forums › Porto – Responsive HTML5 Template › How to add radios to the contact form
- This topic has 2 replies, 2 voices, and was last updated 10 years, 8 months ago by
Jxo. This post has been viewed 1754 times
-
AuthorPosts
-
October 30, 2014 at 5:38 am #10004682
Jxo
ParticipantDear Porto
I’ve added some radios to my contact form. Unfortunately their data$form.find is not working – i receive a mail with no information about the selected radios.
1.a) Is there any need to put some code to the Ajax Submit?
1.b) How can i correctly reset the radios after submitting?
* I’m using the normal contact-form.php
.b)
$('#contactForm').validate({ onkeyup: false, onclick: false, onfocusout: false, rules: { 'datum': { required: true }, 'teilnehmer': { required: true } } });
————————————————————–
The contact-form should disappear if a customer Submit his notification
2.) Which code I have to put in so that the #contactForm (line 1137+) is hidden if response==’success’?
————————————————————–
Thanks!
October 30, 2014 at 5:12 pm #10004692Support
KeymasterHello,
This topic can be helpful: http://www.okler.net/forums/topic/how-to-add-fields-to-the-contact-form/
(Please note the topic is a bit old)But to get the selected value in the radios you need to use something like this:
HTML
<div class="row"> <div class="form-group"> <div class="col-md-12"> <div class="row"> <div class="col-md-12"> <label>Radios</label> </div> </div> <div class="row"> <div class="col-md-12"> <div class="radio-group" data-msg-required="Please select one option."> <label class="radio-inline"> <input type="radio" name="radios" id="inlineRadio1" value="option1"> 1 </label> <label class="radio-inline"> <input type="radio" name="radios" id="inlineRadio2" value="option2"> 2 </label> <label class="radio-inline"> <input type="radio" name="radios" id="inlineRadio3" value="option3"> 3 </label> <label class="radio-inline"> <input type="radio" name="radios" id="inlineRadio2" value="option4"> 4 </label> <label class="radio-inline"> <input type="radio" name="radios" id="inlineRadio3" value="option5"> 5 </label> </div> </div> </div> </div> </div> </div>
JS:
$('input[name=radios]:checked', '#contactForm').val()
To reset the radios:
$('input[name=radios]:checked', '#contactForm').prop('checked', false);
To hide the form you can use this:
$('#contactForm').hide();
Yes, add that in the view.contact.js file, where you have the success status.
Let me know if you have any questions.
Thanks.
October 31, 2014 at 6:22 am #10004700Jxo
ParticipantWonderful! It is working like I want.
Thank you a lot – really nice service!
-
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.