Jump to content


Photo

Arroba (@) Obrigatória No Formulário. Como Fazer ?


  • Faça o login para participar
10 replies to this topic

#1 bryntec

bryntec

    Turista

  • Usuários
  • 46 posts
  • Sexo:Masculino
  • Localidade:Brasil

Posted 16/07/2006, 12:06

Amigos,

Alguém pode me dizer como faço pra num campo de formulário ser obrigatório o uso da "@" (arroba), retornando um erro em javascript caso não seja usada ?

Obrigado.
bryntec.com | Design e Programação Web

#2 Thiago Franzoi

Thiago Franzoi

    Novato no fórum

  • Usuários
  • 3 posts
  • Sexo:Não informado

Posted 16/07/2006, 12:39

Cara tenta esse script abaixo, comigo funcionou...


function validaFormContato(){
//nome do Form de envio
d = document.contato;

//validar nome
if (d.Nome.value == ""){
alert("O campo " + d.Nome.name + " deve ser preenchido!");
d.Nome.focus();
return false;
}

//validar telefone
if (d.Telefone.value == ""){
alert ("O campo " + d.Telefone.name + " deve ser preenchido!");
d.Telefone.focus();
return false;
}

//validar email
if (d.Email.value == ""){
alert("O campo " + d.Email.name + " deve ser preenchido!");
d.Email.focus();
return false;
}
//validar email(verificao de endereco eletrônico)
parte1 = d.Email.value.indexOf("@");
parte2 = d.Email.value.indexOf(".");
parte3 = d.Email.value.length;
if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {
alert ("O campo " + d.Email.name + " deve conter um endereco eletronico! Ex: seunome@seuprovedor.com.br");
d.Email.focus();
return false;
}

//validar assunto
if (d.Assunto.value == ""){
alert("O campo " + d.Assunto.name + " deve ser preenchido!");
d.Assunto.focus();
return false;
}

//validar Mensagem
if (d.Mensagem.value == ""){
alert("O campo " + d.Mensagem.name + " deve ser preenchido!");
d.Mensagem.focus();
return false;
}

return true;
}


Com scrit acima crie um arquivo .js e depois faz a chamada na sua pagina, assim:

<script type="text/javascript" language="javascript" src="validaform.js"></script>


ai vc chama no no seu form assim:

<form action="pagina.html" method="POST" name="contato" onSubmit="return validaFormContato()">

falow t+

#3 Allan Carvalho

Allan Carvalho

    Òó :: ^^

  • Usuários
  • 471 posts
  • Sexo:Masculino
  • Localidade:Campinas - SP
  • Interesses:Um PC novo e rápido. ^^

Posted 16/07/2006, 13:26

Olá!

Thiago, seu script é perfeito e funcional, porém, acho que para esse caso de somente validar um campo de email deve ser feito de uma forma menos complexa. (y)

<script>
function validaemail() {
if (document.getElementById('email').value == ""){
alert("O campo de e-mail deve ser preenchido.");
document.getElementById('email').focus();
return false;
}
else {
arroba = document.getElementById('email').value.indexOf("@");
ponto = document.getElementById('email').value.indexOf(".");
tamanho = document.getElementById('email').value.length;
if (!(arroba >= 2 && ponto >= 3 && tamanho >= 9)) {
alert ("Digite um e-mail válido.\n Exemplo: seunome@seuprovedor.com.br");
document.getElementById('email').focus();
return false;
}
else {
return true;
}
}
}
</script>
<form name="vai" action="pagina.extensão" onsubmit="return validaemail();">
<input type="text" size="20" id="email" />
<input type="submit" value="Validar">
</form>


Entende?

Sem querer ofender, OK? Somente ajudando. (y)

Bom, agradeço sua atenção e compreensão. (y)

Até mais, pessoas.

Fui. ^_^

Edição feita por: invasoesdemaniacos, 16/07/2006, 13:29.

Nome: Allan V. Ferreira de Carvalho.
Localidade: Campinas - SP
Linguagem de desenvolvimento: XHTML | CSS (Tableless) | JavaScript | AJAX | PHP
Contatos: brkamikasecps@gmail.com | brkamikasecps@hotmail.com

Posted Image


#4 Klaus

Klaus

    @ ubuntu jaunty

  • Ex-Admins
  • 7924 posts
  • Sexo:Masculino
  • Localidade:127.0.0.1

Posted 16/07/2006, 14:47

Oi Allan,
sua validação está legal mas, ela barra um e-mail válido do tipo:

a.silva@uol.com.br

Que tal tentar com expressões regulares? :D
Klaus Paiva
Conheça também: Taperás

#5 Allan Carvalho

Allan Carvalho

    Òó :: ^^

  • Usuários
  • 471 posts
  • Sexo:Masculino
  • Localidade:Campinas - SP
  • Interesses:Um PC novo e rápido. ^^

Posted 16/07/2006, 16:04

Hmm...

Verdade...

Desafio lançado, não?

Ok, segue mais enxuto ainda: ^_^

<script>
function validaemail() {
	var email = document.getElementById('email');
	if (email.value == ""){
	alert("O campo de e-mail deve ser preenchido.");
	email.focus();
	return false;
	}
	else {
	var valor = email.value;
	padrao = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
	OK = padrao.exec(valor);
		if (!OK) {
		alert ("Digite um e-mail válido.\n Exemplo: seunome@seuprovedor.com.br");
		document.getElementById('email').focus();
		return false;
		}
		else {
		return true;
		}
	}
}
</script>
<form name="vai" action="pagina.extensão" onsubmit="return validaemail();">
<input type="text" size="20" id="email" />
<input type="submit" value="Validar">
</form>


^_^

Falow. Valeu Klaus. (y)

Bem complicadinho ER. ^_^



Fui. ^_^
Nome: Allan V. Ferreira de Carvalho.
Localidade: Campinas - SP
Linguagem de desenvolvimento: XHTML | CSS (Tableless) | JavaScript | AJAX | PHP
Contatos: brkamikasecps@gmail.com | brkamikasecps@hotmail.com

Posted Image


#6 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 11902 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 26/09/2017, 13:18

Xenical Orlistat 120 Mg viagra cialis Strep Symptoms Even After Taking Amoxicillin Kamagra O Viagra Buy Kamagra Safely
Mavidol cialis Meilleur Site Pour Commander Cialis Which Is Stronger Cipro And Amoxicillin
Acheter Du Cialis 10mg Effetti Collaterali Viagra Generico cialis Cialis Uso Prolungato Cialis Eintritt Wirkung

#7 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 11902 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 08/10/2017, 18:45

Cialis In Venlo Kaufen Viagra 40 Pills For 99 generic levitra no prescription Metabolism Of Cephalexin
Osu Levitra In Farmacia viagra Lasix No Prescription Needed Pfizer Viagra Prezzo

#8 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 11902 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 23/10/2017, 08:37

Toncils Infection Amoxicillin viagra Efectos Viagra Hombre
Propecia Cost Per Month Amoxicillin One Day Over Expire Date Cialis Online Fast Delivery cheap levitra canada Avelox And Zithromax Cytotec A Bas Prix Amoxicillin Mouth Dissolve
Cialis Soft Tabs Online Prezzo Levitra Drug Cost In Canada viagra Best Buy On Cialus

#9 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 13123 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 23/10/2017, 22:23

Cialis English viagra prescription Avigra Sales Aus Amoxicillin For Diabetic And Elderly

#10 fapedlok

fapedlok

    12 Horas

  • Usuários
  • 160 posts
  • Sexo:Masculino
  • Localidade:Brisbane

Posted 24/10/2017, 13:24

Discounts! best hair gel for men progect11.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE Syma x8w rc fpv wifi helicopter drone with camera 2mp wide angle 2.4g 4ch 6axis quadcopter adult boy toy gift rtf vs x8c ( 122.98 $)Cubic Zirconia Bracelet ( 157.50 $)2016 new parquet shoulder shoulder bag fashion small fresh bag Miss Han Banchao dual backpack ( 21.90 $)Online store Luggage Bagway.ru2016 Winter New Fashion Black and White Spell Color Patchwork Hoodies Women V Pattern Pullover Sweatshirt Female Tracksuit M-XXL ( 14.25 $)HawKeye Firefly Q6 4K 120 Degree Angle Action Camera $54.11Laminated python silver sandal wcrystals ( 722.18 $) Roberto CavalliSimplee apparel sexy off shoulder sequin tassel summer dress 2016 beach party short dress women backless vintage dress vestidos ( 37.98 $)Cute Children Cartoon Pokemon Pikachu Wallet Kids Zipper Change Purse Coin Purse Money Bag Pouch Bolsa Girl For Gift ( 1.98 $)Zettaly AVY 407 Bluetooth 4.0 Speaker 7 inch Touchscreen Android 4.4 Quad-core Smart Sound Box 1GB RAM 8GB ROM 2.4G WiFi HDMI Connectivity with 0.3MP Front Camera for iPhone 6S 6S Plus iPad Pro 149.96$Grade 7A Malaysian Virgin Hair With Closure body wave 4pcs Lot, Malaysian Body Wave Hair Bundle with Lace Top Closure 4x4 size ( 63.00 $)US Route 66 Historic Metal Tin Sign Cave Plaque Wall Home Decor Highway Road 1926 812inch ( 6.98 $)Burano New Arrival Hot Sale Soak-off Gel polish gel nail kit nail art tools sets kits manicure set choose 8 colors NEW ( 84.00 $)Casual splicing turn down collar long sleeves shirt for men ( 16.53 $)7a brazilian virgin hair body wave 4 bundles brazilian body wave unprocessed brazilian hair weave bundles human hair weave ( 49.00 $) 47.jpg
Discounts! new beauty 2017

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
5PcsBag Plastic Fishing Rod Pole Hook Keeper for Lures Bait Spoon Treble Fish Hook Safety Holder Fishing Tackle Accessories ( 1.86 $)
Mini Pool Set Billiard Ball Table Game Children Toy-32.63 $
makeup sponge blender beauty original cosmetic puff powder puff retail packing Fast Shipping ( 12.36 $)
7PCS Russian Icing Piping Nozzles Tips Cake Decorating Biscuits Sugarcraft Pastry Tool DIY ZH809 ( 4.46 $)
Bohemian gold and turquoise clip-on earrings ( 507.13 $) Roberto Cavalli
Solid color stylish elastic waist straight leg men's shorts ( 21.97 $)
Get more speed, free malware, registry Clean PC: Advanced PC Fixer
Peruvian curly weave human hair bundles peruvian curly hair wet and wavy human hair 3 bundles peruvian virgin hair natural wave ( 75.40 $)
Active stretchy skinny black and gray spliced women's pants ( 12.25 $)
Car radio mp4 mp5 player 1 din hd with rearview camera 4.1 inch video player bluetooth remote control stereo aux fm usb sd ( 46.58 $)
Sparkling women's long wavy light blonde synthetic hair wig ( 14.47 $)
Ios android app lcd display wirelesstouch screen keypad panel gsm pstn sms home security burglar voice alarm remote arm system ( 125.99 $)
Red Floral Pattern Woven Silk Tie ( 66.00 $)
Simplee Black ruffle warm winter coat Women turndown long coat collar overcoat female Casual autumn 2016 pink outerwear ( 46.65 $)
Aukey usb charger quick charge 3.0 3-port usb wall charger for lg g5 xiaomi samsung galaxy s6edge nexus 6p5x iphone ipad &more ( 34.66 $)


109.png
Discounts! the product review

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
2016 new canvas waterproof travel bag mulitifun ctional out men women luggage men s backpacks bags ( 19.00 $)
Mens Cashmere Lined Brown Italian Leather Gloves ( 98.00 $)
4x UNIVERSAL MOTORCYCLE MOTOR BIKE TURN SIGNAL INDICATOR LIGHT LAMP BLINKER AMBER Arrow 3W ( 12.99 $)
Hot brazilian loose wave virgin hair 4bundle deals 7a rosa hair products human hair soft loose ( 87.15 $)
Transparent TPU Back Protective Cover Case for XiaoMi RedMi Note 2 ( $2.39 )
Tactical military boshile 10x50 navy binoculars with rangefinder and compass reticle illuminant telescope waterproof green color ( 117.50 $)
7a brazilian kinky straight hair with closure yaki straight hair weave coarse yaki human hair brazilian virgin hair with closure ( 95.14 $)
Androu Frej Game of Thrones
2016 New Luxurry Brand Car Key Wallet Purse Men Women Woolen Felt Keychain Holder Pocket Keys Organizer Pouch Case Bag ( 6.71 $)
Raffaello dark gray leather slip on shoe ( 127.10 $) D Acquasparta
2016 Women V Letters Saffiano handbags Women Leather Commuter Office Ring tote bag Women's Pouch Bolsas Famous Ladys V Flap bag ( 33.88 $)
Chispaulo cow womens genuine leather handbags female crossbody bags for women messenger bag lady real women ( 269.40 $)
Brazilian virgin hair body wave 8a brazilian body wave mink brazilian hair weave bundles human hair extension vshow hair company ( 48.00 $)
Yuan Black Set of 4 Extra Plates ( 72.00 $)
Uajzman, Frederik


79bb.jpg
Discounts! best spa products

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Street style beam feet camo print loose fit lace-up parachute pants for men ( 26.32 $)
New kerui g19 pet against pir infrared security motion movement siren sensor detector home smart alarm system ( 113.99 $)
Midnight Blue Nylon Puffer Bow Tie ( 45.00 $)
7A Unprocessed Brazilian Virgin Hair Body Wave 3 bundles Brazilian Body Wave Virgin Hair Human Hair Weave Rosa Hair Products ( 50.25 $)
Shop Eat Village
V-neck button embellished short sleeve men's t-shirt ( 13.61 $)
Fashion women messenger bags handbag waterproof nylon shoulder bag crossbody bags for women casual tote bolsa feminina ladies ( 26.59 $)
Vernee Mars 4G Phablet ( 169.99 $)
Vtoraya zhizn Uve (film)
Red and Black Quilted Wallet On Chain ( 132.00 $)
30917 new fashion canni hot sale 239 colors 7 3ml names canni nail art soak off ( 2.85 $)
VICUNA POLO Unique Buckle Design Irregular Cover Open Mens Messenger Bag 2 Sizes Business Men Crossbody Bag Leather Man Bag Hot ( 31.64 $)
2pcs h7 light bulbs 3000k halogen h7 12v 55w golden yellow fog factory price car styling ( 2.99 $)
Universal Tripod Mount Adapter Telescopic Cell Phone Stand Holder ( $1.93 )
ESP8266 WiFi Wireless Module ( $3.33 )


295.jpg
Discounts! top 10 products 2017 progect11.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE Ophir 6 pcs dual-action airbrush kit 0.2mm 0.3mm 0.35mm 0.5mm nozzle air brush gun for model hobby cake decoration tattoo _ac048 ( 123.19 $)Bohemian gold and turquoise clip-on earrings ( 507.13 $) Roberto CavalliFor Apple iPhone 7 7 Plus Luxury Phone Cases PC frame+silicone TPU hybrid Phone back Cover Coque iPhone 77plus phone shell ( 4.59 $)Rovan engine 30.5cc 4 bolt kit with ruixing carburettor for 15 hpi baja 5b parts king motor ( 106.21 $)Clip In Human Hair Extensions 7Pc Natural Brazilian 7A African American 3B 3C Kinky Curly Clip In Human Hair Extensions Clip Ins ( 126.00 $)20pcs 68mm Blue black White full black 10 pin FOR Car Wheel Center Hub caps Rim Caps Logo Emblem Badge,PN361367683536 ( 22.00 $)New fashion products men women glass bamboo sunglasses au retro vintage wood lens wooden frame handmade ( 15.88 $)Free ship! original viofo a119 2.0 ( 96.89 $)Resin and glass modern lamp led pendent light for dinning living room , lustres e pendentes luz,lustre de para quarto ( 166.23 $)CS-243 Dual USB Charger Motorcycle Power Plug Socket ( $4.65 )Byuzhold, Zhenevev1000A peak current car jump starter power bank 12v emergency car battery booster Multi-function car starter US UK EU AU plugs ( 90.89 $)Locksmith Lock Pick Tool Set ( $8.29 )Bluboo Xfire 2 3G Smartphone-91.15 $Jocelyn Luggage Leather Flat Sandal ( 105.00 $) 15.jpg

#11 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 13123 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 24/10/2017, 16:47

Cephalexin 500 Mg Capsule Tev viagra Purchase Amoxil
Find Acticin Low Price With Overnight Delivery levitra generico prezzo Costo Viagra In Farmacia Capecitabine Buy Tamoxifen Pct
Pharmists In Canada Cialis viagra Viagra Generico Eurofarma Keflex Breast Cyst




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq