PHP Classes

File: test/expect/test_age_date_input.php.html

Recommend this page to a friend!
  Classes of Manuel Lemos   PHP Forms Class with HTML Generator and JavaScript Validation   test/expect/test_age_date_input.php.html   Download  
File: test/expect/test_age_date_input.php.html
Role: Auxiliary data
Content type: text/plain
Description: Expected output of the test_age_date_input.php script
Class: PHP Forms Class with HTML Generator and JavaScript Validation
HTML forms generation and validation.
Author: By
Last change: Added support to avoid giving focus when the focus input is not set.
Date: 5 years ago
Size: 4,840 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Test for Manuel Lemos' PHP form class using the date plug-in input to pick up an age value</title> <style type="text/css"><!-- .invalid { border-color: #ff0000; background-color: #ffcccc; } // --></style> </head> <body onload="document.forms['experience_form']['p_experience_year'].focus()" bgcolor="#cccccc"> <center><h1>Test for Manuel Lemos' PHP form class using the date plug-in input to pick up an age value</h1></center> <hr /> <form method="get" action="" name="experience_form" onsubmit="return ValidateForm(this)"> <script type="text/javascript" defer="defer"> <!-- function ValidationError(form, Invalid, error_message, focus) { alert(error_message) if(focus.length > 0 && form[focus].focus) form[focus].focus() } function ValidateForm(theform) { var e r=theform['p_experience_year'] r.className='' r=theform['p_experience_month'] r.className='' var year=theform['p_experience_year'].options[theform['p_experience_year'].selectedIndex].value var month=theform['p_experience_month'].options[theform['p_experience_month'].selectedIndex].value var day=((year.length || month.length) ? '01' : '') if(!year.length && !month.length) { r=theform['p_experience_year'] r.className='invalid' e='It was not specified a valid year.' ValidationError(theform, {'p_experience_year': e }, e, 'p_experience_year') return false } if(month.length || year.length) { if(month.length==0) month='0' var this_month=10-parseInt(month) if(year.length==0) year='0' var this_year=2008-parseInt(year) while(this_month<1) { this_month+=12 --this_year } month=this_month+'' if(month.length<2) month='0'+month year=this_year+'' if(year.length<2) year='00'+year if(year.length<3) year='0'+year } if(!year.length && (month.length || day.length)) { r=theform['p_experience_year'] r.className='invalid' e='It was not specified a valid year.' ValidationError(theform, {'p_experience_year': e }, e, 'p_experience_year') return false } if(!month.length && (year.length || day.length)) { r=theform['p_experience_month'] r.className='invalid' e='It was not specified a valid month.' ValidationError(theform, {'p_experience_month': e }, e, 'p_experience_month') return false } var date=(year.length<3 ? '00' : '') + ((year.length % 2) ? '0' : '') + year + '-' + month + '-' + day if(date<'1995-01-01') { r=theform['p_experience_year'] r.className='invalid' e='You cannot have that long PHP experience as PHP was only released in 1995.' ValidationError(theform, {'p_experience_year': e }, e, 'p_experience_year') return false } if('2008-10-01'<date) { r=theform['p_experience_year'] r.className='invalid' e='You have not specified a valid experience period.' ValidationError(theform, {'p_experience_year': e }, e, 'p_experience_year') return false } return true } // --> </script> <noscript> <div style="display: none"><!-- dummy comment for user agents without Javascript support enabled --></div> </noscript> <div id="feedback" style="text-align: center;"></div> <br /> <div id="wholeform"> <center><table summary="Form table" border="1" bgcolor="#c0c0c0" cellpadding="2" cellspacing="1"> <tr> <td bgcolor="#000080" style="border-style: none;"><font color="#ffffff"><b>Form Date plug-in test to pick up an age</b></font></td> </tr> <tr> <td style="border-style: none;"><fieldset> <legend><b><label for="p_experience_year" accesskey="E">Your PHP <u>E</u>xperience</label></b></legend> <center><select name="p_experience_year" id="p_experience_year"> <option value="" selected="selected"><!-- --></option> <option value="0"> 0</option> <option value="1"> 1</option> <option value="2"> 2</option> <option value="3"> 3</option> <option value="4"> 4</option> <option value="5"> 5</option> <option value="6"> 6</option> <option value="7"> 7</option> <option value="8"> 8</option> <option value="9"> 9</option> <option value="10"> 10</option> <option value="11"> 11</option> <option value="12"> 12</option> <option value="13"> 13</option> </select> years and <select name="p_experience_month" id="p_experience_month"> <option value="" selected="selected"><!-- --></option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> </select> months</center> </fieldset> <hr /> <center><input type="submit" name="doit" value="Submit" onclick="sub_form='' ; return true" /></center></td> </tr> </table></center> </div></form> <hr /> </body> </html>