Un archivito que me permite mostra formularios al llenarse y como se validan antes de ser enviados al Server.
Realmente este pueder ser mejorado es muchos aspectos y formas para hacer mas optima la codifcacion, pero espero que este aporte les sea util en algo
html ----------------------
Bibliografía
http://www.librosweb.es/xhtml/
http://www.desarrolloweb.com/articulos/1767.php
JavaScrit--------------------------
Crea un archivo de Java Script dentro de una carpeta llamada "js" Aparte ok!!!!
function valida_envia(){
//valido el nombre
if (document.fvalida.firstname.value.length==0){
alert("Enter your name")
document.fvalida.firstname.focus()
return 0;
}
}
function valida_lastname(){
if (document.fvalida.lastname.value.length==0){
alert("Enter your lastname")
document.fvalida.lastname.focus()
return 0;
}
}
function valida_nickname(){
if (document.fvalida.nickname.value.length==0){
alert("Enter your nickname")
document.fvalida.nickname.focus()
return 0;
}
}
function valida_identify(){
if (document.fvalida.identify.value.length==0){
alert("Enter your identify")
document.fvalida.identify.focus()
return 0;
}else
//aqui los valores son asignados
var cedula= document.getElmentById"identify";
var pares=0;
var totalpares;
var impares;
var totalimpares=0;
var total=0;
var decenasuperior;
var digito10;
for (var i=0; i<=cedula.lenght -1; i++)
{
if (i%2 ==0)
{
pares=parseint(cedula.charAt(i))*2;
if(pares>9)
{
pares= pares -9;
}else
alert (Number indentifycation is bad, retype your identification number)
totalpares=pares;
}else
{
impares = parseint (cedula.ChartAt(i));
totalimpares+= impares;
}
}
total=totalpares+totalimpares;
decenasuperior=parseInt(total/10);
decenasuperior=(decenasuperior+1)*10;
digito10=decenasuperior-total
if (digito ==10)
{
digito10=0;
}
alert ("el numero es valido);
}
function valida_cellPhone(){
if (document.fvalida.cellphone.value.length==0){
alert("Enter your cellphone number ")
document.fvalida.cellphone.focus()
return 0;
}
}
function valida_email(){
if (document.fvalida.email.value.length==0){
alert("Enter your email")
document.fvalida.email.focus()
return 0;
}
}
function valida_contrasena(){
if (document.fvalida.contrasena.value.length==0){
alert("Enter your Password")
document.fvalida.contrasena.focus()
return 0;
}
}
function valida_password(){
if (document.fvalida.password.value.length==0){
alert("Retype your password ")
document.fvalida.password.focus()
return 0;
}
}
function valida_mission(){
if (document.fvalida.descripcion.value.length==0){
alert("Think in something and type your descripcion ")
document.fvalida.descripcion.focus()
return 0;
}
}
php------------------------
Crea un archivo de PHP aparte, pero al mismo nivel de index, por que la codificacion lo buscara en esa forma.
echo '
Hi: '.$_POST['firstname'].' '. $_POST['lastname'];
echo '
Hellow: '.$_POST['nickname'];
echo '
Your sex: '.$_POST['sex'];
echo '
Your Status: '.$_POST['status'];
echo '
Your identify: '.$_POST['indetify'];
echo '
Phone: '.$_POST['cellphone'];
echo '
Password: '.$_POST['contrasena'];
echo '
Password retyped:'.$_POST['password'];
$hobies= $_POST['hobby'];
for ($i=0;$i
echo '
- Informatic Skill: '.$_POST['program'];
echo '
Informatic Skill2: '.$_POST['so'];
echo '
Informatic Skill2: '.$_POST['so2'];
echo '
Informatic Skill3: '.$_POST['so3'];
echo '
Mission:'.$_POST['descripcion'];
?>






