[Vtigercrm-commits] [vtiger-commits] r9831 - /customerportal/trunk/login.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Nov 14 06:36:43 EST 2006
Author: richie
Date: Tue Nov 14 04:36:40 2006
New Revision: 9831
Log:
* Added form validation, now we will not face apache redirection error
Modified:
customerportal/trunk/login.php
Modified: customerportal/trunk/login.php
==============================================================================
--- customerportal/trunk/login.php (original)
+++ customerportal/trunk/login.php Tue Nov 14 04:36:40 2006
@@ -21,7 +21,7 @@
if($_REQUEST['close_window'] == 'true')
{
?>
- <script>
+ <script language="javascript">
window.close();
</script>
<?php
@@ -79,18 +79,18 @@
</tr>
<tr>
<td class="dvtCellLabel" align="right" width="50%">Email ID : </td>
- <td class="dvtCellInfo"><input type="text" name="username" class="detailedViewTextBox"></td>
+ <td class="dvtCellInfo"><input type="text" id="username" name="username" class="detailedViewTextBox"></td>
</tr>
<tr>
<td class="dvtCellLabel" align="right">Password :</td>
- <td class="dvtCellInfo"><input type="password" name="pw" class="detailedViewTextBox"></td>
+ <td class="dvtCellInfo"><input type="password" id="pw" name="pw" class="detailedViewTextBox"></td>
</tr>
<tr>
<td> </td>
<td align="right"><a href='javascript:;' onclick='window.open("supportpage.php?param=forgot_password","ForgotPassword","width=400,height=250");'><?php echo $mod_strings['LBL_FORGOT_LOGIN']?></a></td>
</tr>
<tr>
- <td colspan="2" align="center"><input type="image" src="images/loginBtnSignin.gif"></td>
+ <td colspan="2" align="center"><input type="image" src="images/loginBtnSignin.gif" onclick="return validateLoginDetails();"></td>
</tr>
<tr>
<td class="dvtCellInfo" colspan="2"></td>
@@ -131,5 +131,40 @@
</body>
</html>
+<script language="javascript">
+function validateLoginDetails()
+{
+ var user = trim(document.getElementById("username").value);
+ var pass = trim(document.getElementById("pw").value);
+ if(user != '')
+ {
+ if(pass != '')
+ return true;
+ else
+ {
+ alert("Please enter a valid password.");
+ return false;
+ }
+ }
+ else
+ {
+ alert("Please enter valid username.");
+ return false;
+ }
+}
+function trim(s)
+{
+ while (s.substring(0,1) == " " || s.substring(0,1) == "\n")
+ {
+ s = s.substring(1, s.length);
+ }
+ while (s.substring(s.length-1, s.length) == " " || s.substring(s.length-1,s.length) == "\n") {
+ s = s.substring(0,s.length-1);
+ }
+ return s;
+}
+
+</script>
+
<?php
?>
More information about the vtigercrm-commits
mailing list