| | |
How to string length through javascripts in PHP
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 21
Reputation:
Solved Threads: 0
Hey Guys,
I am new to PHP and know nothing of java scripts. I have to build a web page where user enters login information at the time of registration. I have taken help of a PHP tool to generate the required scripts. Now in that I have to incorporate a functionality to check the password length and give appropiate message if password is too short. I think I could enter this functionality through javascripts but I don't know how. I am attaching the file in which the PHP scripts are written. Please help me out.
I am new to PHP and know nothing of java scripts. I have to build a web page where user enters login information at the time of registration. I have taken help of a PHP tool to generate the required scripts. Now in that I have to incorporate a functionality to check the password length and give appropiate message if password is too short. I think I could enter this functionality through javascripts but I don't know how. I am attaching the file in which the PHP scripts are written. Please help me out.
This is how you get the length of a string.
BTW: its all html when it hits the browser
javascript Syntax (Toggle Plain Text)
var stringlen = stringvarname.length;
BTW: its all html when it hits the browser
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
Hi,
Replace the ew_ValidateForm javascript function with
Check for the code that I have added.
in the block
//Added by vivek Rawat here to check the length of pasword
Replace the ew_ValidateForm javascript function with
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
function ew_ValidateForm(fobj) { if (fobj.a_confirm && fobj.a_confirm.value == "F") return true; var i, elm, aelm, infix; var rowcnt = (fobj.key_count) ? Number(fobj.key_count.value) : 1; for (i=0; i<rowcnt; i++) { infix = (fobj.key_count) ? String(i+1) : ""; elm = fobj.elements["x" + infix + "_user_name"]; if (elm && !ew_HasValue(elm)) { if (!ew_OnError(elm, "Please enter required field - User Name")) return false; } elm = fobj.elements["x" + infix + "_password"]; if (elm && !ew_HasValue(elm)) { if (!ew_OnError(elm, "Please enter required field - Password")) return false; } //Added by vivek Rawat here to check the length of pasword minlength=6; if (elm) { if(elm.value.length < minlength) { alert("Password should have minimum "+minlength+" characters"); return false; } } //end added by vivek rawat elm = fobj.elements["x" + infix + "_user_id"]; if (elm && !ew_HasValue(elm)) { if (!ew_OnError(elm, "Please enter required field - User ID")) return false; } elm = fobj.elements["x" + infix + "_user_id"]; if (elm && !ew_CheckInteger(elm.value)) { if (!ew_OnError(elm, "Incorrect integer - User ID")) return false; } elm = fobj.elements["x" + infix + "_user_access_rights"]; if (elm && !ew_HasValue(elm)) { if (!ew_OnError(elm, "Please enter required field - User Access Rights")) return false; } } return true; }
Check for the code that I have added.
in the block
//Added by vivek Rawat here to check the length of pasword
Vivek Rawat
Keep solving complexities.
Keep solving complexities.
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Problem with javascript code in Mozilla firefox.
- Next Thread: Suggestions on Web Project Topic
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxexample ajaxjspservlets api autoplay blackjack browser bug captchaformproblem checkbox child class close codes cookies createrange() cursor date debugger dependent developer disablefirebug dom dropdown editor element embed engine events explorer ext file flash form forms game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jump libcurl maps math matrixcaptcha media mp3 mysql object onerror onmouseoutdivproblem onreadystatechange parent passing paypal pdf php player position post programming progressbar rated runtime safari scriptlets scroll search security session shopping size software star stars stretch synchronous tweet unicode variables web webkit webservice window wysiwyg \n





