Skip to content

Instantly share code, notes, and snippets.

@modxws
modxws / modxws-urok9-3-1.html
Created June 23, 2012 14:50
HTML: modxws-urok9-3-1
[[!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` ]]
@modxws
modxws / modxws-urok9-3-3.html
Created June 23, 2012 14:52
HTML: modxws-urok9-3-3
<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" />
@modxws
modxws / modxws-urok9-3-2.html
Created June 23, 2012 14:54
HTML: modxws-urok9-3-2
<p>Name: [[+name]]</p>
<p>Email: [[+email]]</p>
<p>Phone: [[+phone]]</p>
<p>Budget: [[+budget]]</p>
<p>Comments: [[+comments]]</p>
@modxws
modxws / modxws-urok9-3-4.js
Created June 23, 2012 14:56
JS: modxws-urok9-3-4
$(document).ready(function(){
$("form#contactForm").submit(function() {
//When the form is submitted
});
});
@modxws
modxws / modxws-urok9-3-5.js
Created June 23, 2012 14:57
JS: modxws-urok9-3-5
$(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){
@modxws
modxws / modxws-urok9-3-6.js
Created June 23, 2012 15:00
JS: modxws-urok9-3-6
var elem = $("form#contactForm").children('fieldset').children('input, textarea');
@modxws
modxws / modxws-urok9-3-7.js
Created June 23, 2012 15:01
JS: modxws-urok9-3-7
elem.each(function(index){
@modxws
modxws / modxws-urok9-3-8.js
Created June 23, 2012 15:02
JS: modxws-urok9-3-8
if($(this).hasClass('required')==true){
if(!this.value || this.value == this.defaultValue ) {
@modxws
modxws / modxws-urok9-3-9.js
Created June 23, 2012 15:08
JS: modxws-urok9-3-9
//Добавьте класс ошибки в CSS
$(this).addClass("error");
error = true;
if(!foc)foc = $(this).attr("id"); //Если "foc" (focus) пуст назначить его ID первого элемента, который не соответствует требованию.
@modxws
modxws / modxws-urok9-3-10.js
Created June 23, 2012 15:09
JS: modxws-urok9-3-10
if (error){
if(foc)$('#'+foc).css("color","#000").css("fontStyle","normal").focus();
return false;