11-10-2009, 08:46 PM
|
#3 (permalink)
|
|
The Acquainted
Join Date: May 2009
Posts: 178
Thanks: 9
|
The javascript works in safari on my laptop using XP. It doesnt however work on my iphone. What i'm asking is "anybody have experience of this situation?"
In any case here's an example of some the javascript which works on safari on my laptop:
PHP Code:
function inviteFormVerifyMe(){
var msg='';
if(document.getElementById('email').value==''){
msg+='- Email\n\n';}
if(document.getElementById('retypeemail').value==''){
msg+='- Retype Email\n\n';}
if(msg!=''){
alert('The following fields are empty or invalid:\n\n'+msg);
return false
}else{
return true }
}
The function is called here:
PHP Code:
public function displayform() {
$yourname = '';
if (isset($_POST['yourname'])) {
$yourname = $_POST['yourname'];
}
$message = '';
if (isset($_POST['message'])) {
$message = $_POST['message'];
}
$email = '';
if (isset($_POST['email'])) {
$email = $_POST['email'];
}
$form = '';
$form .= "<div id='inviteform'>";
$form .= "<form name='invite' action='invites.php' method='POST' enctype='application/x-www-form-urlencoded' onsubmit='return inviteFormVerifyMe();'>";
$form .= "<table class='invite' cellspacing='0'>";
$form .= $this->displayError();
$form .= "<tr>";
$form .= "<td><LABEL for='yourname' ACCESSKEY='none' >Your Real Name:</td>";
$form .= "<td><input type='text' name='yourname' id='yourname' size='30' maxlength='100' value='".$yourname."'></td>";
$form .= "</tr>";
$form .= "<tr>";
$form .= "<td><LABEL for='message' ACCESSKEY='none' >Message:</td>";
$form .= "<td><textarea name='message' id='message' cols='23' rows='10' value='".$message."'></textarea></td>";
$form .= "</tr>";
$form .= "<tr>";
$form .= "<td><LABEL for='email' ACCESSKEY='none' ><b class='red'>*</b>Email:</td>";
$form .= "<td><input type='text' name='email' id='email' size='30' maxlength='100' value='".$email."'></td>";
$form .= "</tr>";
$form .= "<tr>";
$form .= "<td><LABEL for='retypeemail' ACCESSKEY='none' ><b class='red'>*</b>Retype Email:</td>";
$form .= "<td><input type='text' name='retypeemail' id='retypeemail' size='30' maxlength='100' value=''></td>";
$form .= "</tr>";
$form .= "<tr>";
$form .= "<td colspan='2' align='right'><input type='submit' name='submit' value='Send'><input type='hidden' name='token' value='".$_SESSION['token']."' /><br /></td>";
$form .= "</tr>";
$form .= "</table>";
$form .= "</form>";
$form .= "</div>";
return $form;
}
|
|
|
|