This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[!FormIt? | |
&hooks=`email,redirect` | |
&emailTpl=`contactFormTpl` | |
&emailFrom=`from@domain.com` | |
&emailFromName=`Your Site Name` | |
&emailSubject=`Message From Your Site Name` | |
&emailTo=`email@domain.com` | |
&redirectTo=`36` | |
&validate=`name:required, email:email:required, comments:required:stripTags` ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="contactForm" action="[[~[[*id]]]]" method="post"> | |
<fieldset> | |
<label for="name">Your Name* [[!+fi.error.name]]</label> | |
<input type="text" name="name" id="name" value="First and last name[[!+fi.name]]" class="required" autofocus /> | |
<label for="email">Your Email* [[!+fi.error.email]]</label> | |
<input type="email" name="email" id="email" value="example@domain.com[[!+fi.email]]" class="required" /> | |
<label for="phone">Your Phone Number</label> | |
<input type="tel" name="phone" id="phone" value="555-555-5555" /> | |
<label for="budget">Project Budget</label> | |
<input type="text" name="budget" id="budget" value="Ex. $5000 - $10k" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Name: [[+name]]</p> | |
<p>Email: [[+email]]</p> | |
<p>Phone: [[+phone]]</p> | |
<p>Budget: [[+budget]]</p> | |
<p>Comments: [[+comments]]</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$("form#contactForm").submit(function() { | |
//When the form is submitted | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$("form#contactForm").submit(function() { | |
//When the form is submitted | |
var elem = $("form#contactForm").children('fieldset').children('input, textarea'); | |
var error,foc; | |
//Loop through each input and textarea | |
elem.each(function(index){ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elem = $("form#contactForm").children('fieldset').children('input, textarea'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elem.each(function(index){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if($(this).hasClass('required')==true){ | |
if(!this.value || this.value == this.defaultValue ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Добавьте класс ошибки в CSS | |
$(this).addClass("error"); | |
error = true; | |
if(!foc)foc = $(this).attr("id"); //Если "foc" (focus) пуст назначить его ID первого элемента, который не соответствует требованию. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (error){ | |
if(foc)$('#'+foc).css("color","#000").css("fontStyle","normal").focus(); | |
return false; |