Forums

Email Field Question

dalbeck 04 Dec, 2007
Hello,

I created a couple forms, and when I am not logged in on my site they display correctly. But as soon as I log in the Email Address field displays this: <script language='JavaScript' type='text/javascript'>


Can anyone help me out? Much appreciated.
GreyHead 04 Dec, 2007
Hi dalbeck,

Pretty much impossible to diagnose with so little info - but I'd guess that maybe you've left the <script> tags in the form JavaScript??

Bob
dalbeck 05 Dec, 2007
Hello,

This is the code I have entered in the "Form Javascript Field"

function checkform () {
  if (document.ChronoContact_checkincheckout.fromname.value==""«»){
    alert("Please typ your name"«»);
    document.ChronoContact_checkincheckout.fromname.focus();
    return false;
  }
  if (document.ChronoContact_checkincheckout.fromemail.value==""«»){
    alert("Please typ your email"«»);
    document.ChronoContact_checkincheckout.fromemail.focus();
    return false;
  }
  return true;
}



I hope that helps.
GreyHead 05 Dec, 2007
Hi dalbeck,

No, all that looks good to me. Please take a back up copy of your form form the Forms Manager and post it here or email it to me at the address in my sig and I'll take a closer look.

Bob<br><br>Post edited by: GreyHead, at: 2007/12/04 19:20
dalbeck 05 Dec, 2007
Hello Again,

I will copy and paste the code from all the sections that contain code. I really appreciate your help!

This is from the "Form HTML"
<?php
global $my,$mosConfig_live_site;
// first we check if the user is logged
// if so, then we fill out some fields and set them to read only
$readonl="";
$in="";
$out="";
if ($my->id) {
$out=" SELECTED";
$readonl=" readonly='readonly'";
} else {
$in=" SELECTED";
}
?>
<style type="text/css">
<!--
.style1 {font-size: large}
-->
</style>

<fieldset>
<span class="style1"><strong>Information Technology Department - Absentee Request Form</strong>
<label for="fromname"></label>
</span>
<label for="fromname"><br>
<br>
Name : </label>
<input type="text" name="fromname" id="fromname" tabindex="510" value="<?php echo $my->name?>"<?php echo $readonl?> /><br /><br />
<label for="fromemail">Email : </label><input type="text" name="fromemail" id="fromemail" tabindex="511" value="<?php echo $my->email?>"<?php echo $readonl?> /> <br /> <br />
<label for="inout">Reason : </label><select name="inout" id="inout" tabindex="512">
<option value="Personal"<?php echo $in ?>>Personal Day</option>
<option value="Sick">Sick Day</option>
<option value="Floating Holiday"<?php echo $out ?>>Floating Holiday</option>
<option value="Vacation"<?php echo $out ?>>Vacation Time</option>
<option value="Trade Show"<?php echo $out ?>>Trade Show</option>
<option value="Off Site Training"<?php echo $out ?>>Off Site Training</option>
<option value="Other"<?php echo $out ?>>Other</option>
</select> <br />
<br />
<table width="200" border="0">
  <tr>
    <td>Start Date:</td>
    <td>End Date:</td>
  </tr>
  <tr>
    <td><label for="futdate"></label>
<input type="text" name="futdate" id="futdate" tabindex="513" value="mm/dd/yyyy" /> </td>
    <td><label for="label"></label>
<input type="text" name="futdate2" id="label" tabindex="513" value="mm/dd/yyyy" /></td>
  </tr>
</table>
<i>Please type the dates in the field above</i><br />
<br>
Details :<br />
<label for="details"></label>
<textarea cols=40 rows=4 name="details" id="details" tabindex="514"></textarea><br />
</fieldset>
<fieldset>
<legend>Send</legend>
<?php if(!$my->id){ ?>  
{imageverification}
<?php } ?>
<input type="submit" value="Send" tabindex="515" /> <input type="reset" value="Start over" tabindex="516" /></fieldset>
<script language="javascript">
document.ChronoContact_checkincheckout.fromname.focus();
</script>



This is from the "Form Javascript"
function checkform () {
  if (document.ChronoContact_checkincheckout.fromname.value==""«»){
    alert("Please typ your name"«»);
    document.ChronoContact_checkincheckout.fromname.focus();
    return false;
  }
  if (document.ChronoContact_checkincheckout.fromemail.value==""«»){
    alert("Please typ your email"«»);
    document.ChronoContact_checkincheckout.fromemail.focus();
    return false;
  }
  return true;
}


This is from the "Element Titles"

fromname=Name
fromemail=Email address


This is from the "Auto Generated Tab":
<?php 
	global $database;
	
$database->setQuery( "INSERT INTO #__chronoforms_4 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:«»s"«»)."', '".$_SERVER['REMOTE_ADDR']."' , '".$_POST['fromname']."' , '".$_POST['fromemail']."' , '".$_POST['inout']."' , '".$_POST['futdate']."' , '".$_POST['futdate2']."' , '".$_POST['details']."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>


This is under the "Data View Fields Tab": Main String Ref: Record #n


Let me know if you need more. This is basically an edit of the sample form. Once again your help is greatly appreciated.
GreyHead 05 Dec, 2007
Hi dalbeck,

:( works fine here, no signs of any stray code in the form boxes.

One possiblity: I remember something like this happening when email cloaking is on. Do you have the mambot enabled?

Later; just looked and you are echoing $my->email so that would explain why it only happens when you are logged on.

Bob<br><br>Post edited by: GreyHead, at: 2007/12/04 19:55
dalbeck 05 Dec, 2007
That did it!

The email cloaking was the problem. Thank you so much for spending your time to look in to the problem. Your support is wonderful and much much much appreciated !!! :laugh:
This topic is locked and no more replies can be posted.