Jump to content

contact form with two radio buttons: a yes and a no.


Recommended Posts

Hi everybody !!

 

Here is my problem:

I have a contact form with two radio buttons: a yes and a no.

I would like one or the other is checked by default according to the value 'yes' or 'no'

I know if I am very clear but instead of words, here is my code:

yes no button for radio:

 

<div class="feildset">

		<div class="col1">

                               <div>
				<form>
					<span>Êtes-vous déjà client: requis*</span>
                                               <input type="radio" name="Oui" value="Oui" tabindex="1"requred="required" /> Oui
                                               <input type="radio" name="Non" value="Non" tabindex="2" checked="checked" requred="required" /> Non						
				</form>
			</div>

                               <div>
				<form>
					<span>Avez vous déjà un nom de domaine: requis*</span>
                                               <input type="radio" name="Oui" value="Oui" tabindex="3" requred="required" /> Oui
                                               <input type="radio" name="Non" value="Non" tabindex="4" checked="checked" requred="required" /> Non

                                        <label>
                                               <span>Ce champ est facultatif.</span>						
					<input name="domaine" value="{$domaine}" placeholder="S'il vous plaît entrez votre nom de domaine" type="text" tabindex="5" requred="required" autofocus="autofocus" />					       
				</label>
                                       </form>
			</div>

			<div>
				<label>
					<span>{$LANG.contactname}: requis*</span>
					<input  name="name" value="{$name}" placeholder="S'il vous plaît entrez votre nom" type="text" tabindex="6" requred="required" autofocus="autofocus" />
				</label>
			</div>

			<div>
				<label>
					<span>{$LANG.contactemail}: requis*</span>
					<input name="email" value="{$email}" placeholder="S'il vous plaît entrer votre e-mail" type="email" tabindex="7" requred="required" />
				</label>
			</div>

 

I already did a test

but already, whatever the value, the No button is always checked! whereas normally if I put yes, it should not be checked ...

 

 

if I put yes, I want the field "This field is optional" appears

 

<div>
				<form>
					<span>Avez vous déjà un nom de domaine: requis*</span>
                                               <input type="radio" name="Oui" value="Oui" tabindex="3" requred="required" /> Oui
                                               <input type="radio" name="Non" value="Non" tabindex="4" checked="checked" requred="required" /> Non

                                        <label>
                                               <span>Ce champ est facultatif.</span>						
					<input name="domaine" value="{$domaine}" placeholder="S'il vous plaît entrez votre nom de domaine" type="text" tabindex="5" requred="required" autofocus="autofocus" />					       
				</label>
                                       </form>
			</div>

			<div>

 

 

then change the value: for a list

 

<div>
				<label>
					<span>{$LANG.contactsubject}: ({$LANG.required})</span>
					<input name="subject" value="{$subject}" placeholder="{$LANG.contact_subject}" type="text" tabindex="3" requred="required" />
				</label>
			</div>

 

 

replace with

 

replace the subject by subject field

<div>
				<label>
					<select class="placeholder" tabindex="8" required="required" name="subject" id="subject">
	                                <option value="">Sujet de votre demande</option>
	                                <option value="Nom de domaine">Nom de domaine</option>
	                                <option value="Hébergement">Hébergement</option>
	                                <option value="Référencement">Référencement</option>
	                                <option value="Serveur dédié & VPS">Serveur dédié & VPS</option>
	                                <option value="Service commercial">Service commercial</option>
	                                <option value="Service abuse">Service abuse</option>
	                                </select>
				</label>
			</div>	

 

the problem send a test message

it does not work

 

 

thank you for your help !!

Edited by hostingames
replace the subject by subject field
Link to comment
Share on other sites

Hi,

 

I would like if you click yes lowest part hidden appears:

 

If you click No (on the question Are you already a customer) this hidden part must not appear.

However I have no idea how to do (I started very javascript) ^^

 

Is that you can help me please?

Thank you in advance

 

 

<div>
				<form>
					<span>Avez vous déjà un nom de domaine: requis*</span>
                                               <input type="radio" name="choix" value="oui" id="oui" requred="required" /> Oui
                                               <input type="radio" name="choix" value="non" id="non" requred="required" checked="checked" /> Non

                                        <label>
                                               <span>Ce champ est facultatif.</span>						
					<input name="domaine" value="{$domaine}" placeholder="S'il vous plaît entrez votre nom de domaine" type="text" tabindex="5" requred="required" autofocus="autofocus" />					       
				</label>
                                       </form>
			</div>

			<div>

 

 

 

 

code running) except that when you clicked yes, and that result is clicked not the same when hidden area remains

 

 

 

<div>
				<form>
					<span>Avez vous déjà un nom de domaine: requis*</span>
                                               <input type="radio" name="choix" value="oui" id="oui" requred="required" onClick="afficher();" /> Oui
                                               <input type="radio" name="choix" value="non" id="non" requred="required" checked="checked" /> Non

                                               <p id="champ_cache">
                                               <label>
                                               <span>Ce champ est facultatif.</span>						
					<input name="domaine" value="{$domaine}" placeholder="S'il vous plaît entrez votre nom de domaine" type="text" tabindex="5" requred="required" autofocus="autofocus" />					       
				        </label>
                                               </p>

                                               <script type="text/javascript">
                                               document.getElementById("champ_cache").style.display = "none";

                                               function afficher()
                                               {
                                               document.getElementById("champ_cache").style.display = "block";
                                               }
                                               </script>

                                       </form>
			</div>

			<div>

 

 

 

 

tell me if this is correct

I found

 

 

 

<div>
				<form>
                                               <label>Avez vous déjà un nom de domaine :</label>						
                                               <input type="radio" name="domaine" value="1" id="client" /> Oui
                                               <input type="radio" name="domaine" value="0" id="noclient" checked="checked" /> Non


                                               <div class="" id="domaine_input" style="display: block;">                                               													
                     	                        <input type="text" placeholder="Votre nom de domaine" name="domaine"  value="{$domaine}" />
			                <p>Ce champ est facultatif.</p>
				        </div>		

                                               <script type="text/javascript">
                                               $(document).ready(function(){
                                            $('input[name="domaine"]').change(function() {
	                                        if ($('input[name="domaine"]:checked').val() == 1) {
		                                    $('#domaine_input').show('normal');
	                                        } else {
		                                    $('#domaine_input').hide('normal');
	                                         }
                                             });
                                             });
                                             </script>
                                       </form>
			</div>

Edited by hostingames
code
Link to comment
Share on other sites

hi, whmcs v6

 

Need help

 

person would have an idea please

 

the fields hide it appears http://prntscr.com/7rys7a

 

<div class="feildset">

		<div class="col1">


                               <div>
				<form>
					<label>Êtes-vous déjà client: </label>
                                               <input type="radio" name="choix" value="oui" id="oui" /> Oui
                                               <input type="radio" name="choix" value="non" id="non" checked="checked" /> Non						
				</form>
			</div>

                               <div>
				<form>
					<label>Avez vous déjà un nom de domaine: </label>
                                               <input type="radio" name="inputdomaine" value="1" id="client"  /> Oui
                                               <input type="radio" name="inputdomaine" value="0" id="noclient" checked="checked" /> Non


                                               <div class="" id="domaine_input" style="display: block;">
                                               <span>Ce champ est facultatif.</span>													
                     	                        <input class="" type="text" placeholder="Votre nom de domaine" name="domaine"  value="{$domaine}" />				
				                            </div>		

                                               <script>
                                               $(document).ready(function(){
                                            $('input[name="inputdomaine"]').change(function() {
	                                        if ($('input[name="inputdomaine"]:checked').val() == 1) {
		                                    $('#domaine_input').show('normal');
	                                        } else {
		                                    $('#domaine_input').hide('normal');
	                                         }
											}); 
                                             $('input[name="inputClient"]').change(function() {
	                                        if ($('input[name="inputClient"]:checked').val() == 1) {
		                                    $('#is_client').show('normal');
		                                    $('#not_client_form').hide();
	                                        } else {
		                                    $('#is_client').hide();
		                                   $('#not_client_form').show('normal');
	                                       }
                                           });
                                              }); 
                                             </script>
                                       </form>
			</div>

			<div>
				<label>
					<span>{$LANG.contactname}: requis*</span>
					<input  name="name" value="{$name}" placeholder="S'il vous plaît entrez votre nom" type="text" tabindex="6" requred="required" autofocus="autofocus" />
				</label>
			</div>

			<div>
				<label>
					<span>{$LANG.contactemail}: requis*</span>
					<input name="email" value="{$email}" placeholder="S'il vous plaît entrer votre e-mail" type="email" tabindex="7" requred="required" />
				</label>
			</div>

			<div>
				<label>
                                               <span>Sujet de votre demande: requis*</span>
					<select class="" tabindex="8" required="required" name="subject" id="subject">
	                                <option value="">Sujet de votre demande</option>
	                                <option value="Nom de domaine">Nom de domaine</option>
	                                <option value="Hébergement">Hébergement</option>
	                                <option value="Référencement">Référencement</option>
	                                <option value="Serveur dédié & VPS">Serveur dédié & VPS</option>
	                                <option value="Service commercial">Service commercial</option>
	                                <option value="Service abuse">Service abuse</option>
	                                </select>
				</label>
			</div>								

			<div>
				<label>
					<span>{$LANG.contactmessage}: requis*</span>
					<textarea name="message" placeholder="S'il vous plaît entrez votre message" tabindex="9" required="required">{$message}</textarea>
				</label>
			</div>


			{if $capatacha}
			<p class="center"><strong>{$LANG.captchatitle}</strong></p>
			<p class="center">{$LANG.captchaverify}</p>
			{if $capatacha eq "recaptcha"}
			<div align="center">{$recapatchahtml}</div>
			{else}
			<p class="center"><img src="includes/verifyimage.php" align="middle" /> <input type="text" name="code" tabindex="10" class="capcha" /></p>
			{/if}
			{/if}


		  <p class="center">
		    <input type="submit" value="{$LANG.contactsend}" class="button1 color2" />
		  </p>

		  </div>

	</div>	  

</form>

 

 

 

 

 

 

thank you

Edited by hostingames
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated