Reply
please help me out
Old 05-15-2007, 04:39 AM please help me out
Experienced Talker

Posts: 33
Name: subhash garai
here is a coding i am posting where i can not implement the javascript validation.

please tell me what i should correct here


<?php

$header .= "Email Team Members";

$content.="
<html>
<head>

<style type=\"text/css\">
.inputbox {
font-family: Verdana;
font-size: 10x;
border: 1px solid #999999;
background-color: #EFEEDA;
}
.normal {
font-family: Verdana;
font-size: 8pt;
}
.inputbox2 {
font-family: Verdana;
font-size: 10x;
border: 1px solid #999999;
}
</style>
<SCRIPT LANGUAGE='JavaScript'>

function check()
{
alert('My name is Subhash');
if(document.frm.name.value == '')
{
alert(Please Enter Your Name);
document.frm.name.focus();
return false;
}

if(document.frm.email.value == '')
{
alert('Please Enter Email Address');
document.frm.email.focus();
return false;
}
if(document.frm.email.value != '')
{
var a=document.frm.email.value.indexOf('@',2);
var b=document.frm.email.value.indexOf('.',4);
if(a == -1 || b == -1)
{
alert('Invalid Email Address');
document.frm.email.focus();
return false;
}
}

if(document.frm.to_email.value == '')
{
alert('Please Select Email Address');
document.frm.to_email.focus();
return false;
}
if(document.frm.to_email.value != '')
{
var a=document.frm.to_email.value.indexOf('@',2);
var b=document.frm.to_email.value.indexOf('.',4);
if(a == -1 || b == -1)
{
alert('Selected Email Address is Invalid!');
document.frm.to_email.focus();
return false;
}
}
if(document.frm.comments.value == '')
{
alert('Please Enter Your comments');
document.frm.comments.focus();
return false;
}

return true;
}

</SCRIPT>
</head>
<body>
<table width=500 border=0 cellpadding=0 cellspacing=0 >
<tr>
<td align=center valign=top scope=col>

<form action='#' method=post name=frm onSubmit=return check()>
<table border=0 cellspacing=5 cellpadding=4 width=100% align=center class=normal>

<tr>
<td align=right class=textb>
Your Name:
</td>
<td>
<input class=inputbox type=text name=name>
</font>
</td>
</tr>
<tr>
<td align=right class=textb>
Your email:</font></td>
<td >
<input class=inputbox type=text name=email>
</font></td>
</tr>
<tr>
<td align=right class=textb>
To:</font></td>
<td >
<select class=inputbox name=to_email selected>
<option value='' selected>--Please select address --</option>
</font></td>
</tr>
<tr>
<td align=right class=textb>
Your Comments:</font></td>
<td>
<textarea name=comments rows=10 cols=28 class=inputbox></textarea>
</font></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align=left>
<img src='pages/CaptchaSecurityImages.php?width=100&height=40&char acters=5' />
</td>
</tr>
<tr>
<td align=right class=textb>
Enter Security Code:</font></td>
<td align=left>
<input class=inputbox type=text name=sec_code>
</font></td>
</tr>
<TR valign=top align=center>
<TD colspan=2>
<INPUT class=inputbox2 TYPE='reset' value='Reset'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT class=inputbox2 TYPE=submit value=Submit></TD>
</TR>
</table>

<!-- ================end of body text =========================== -->

</td>
</tr>
</table>
</body>
</html>
";
?>


In a page it is called like--------> <a href=\"inside.php?page=email\" class=\"style2\">Email Us</a>

tell me the probs over here
subhash_garai is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-15-2007, 06:50 AM Re: please help me out
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
first why don't you use html tags makes the code look more readable

One problem i see is the lack of double quotes :
Quote:
<form action="#" method="post" name="frm" onSubmit="return check()">
another thing you can do is use this tag :
Quote:
<form action="#" method="post" name="frm" onSubmit="return check(this)">
and inside the javascript
HTML Code:
function check(checked_form)
{
  alert('My name is Subhash');
  if(checked_form.name.value == '')
  {
     alert(Please Enter Your Name);
     checked_form.name.focus();
     return false;
  }
__________________
If you like my posts ... TK is appreciated:)
Web Directory | Blog
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Old 05-15-2007, 09:44 AM Re: please help me out
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 551
Name: surajit ray
Location: inside the heart of my friends
You never ended the </form> tag, that's the problem. To make that work just put the form end tag.
happy coding.
__________________
Think+, work +, but not HIV + :)
jito is offline
Reply With Quote
View Public Profile
 
Old 05-17-2007, 08:58 AM Re: please help me out
Novice Talker

Posts: 6
Name: Rashmi Priya
Please go through the code and see if you have missed any tags.
rashmijsr is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to please help me out
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13100 seconds with 12 queries