
November 20th, 2007, 06:30 PM
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Time spent in forums: 25 m
Reputation Power: 0
|
|
WML - Wap setfocus
hi
is there a wmlscript function to be set to run when a page loads (based on a flag - saw a get request variable == 2)
and on that fucntion to set focus to a particular input text box?
Domain: I have a form with 4 text boxes
need to go to the 3rd box when user returns from a particular link
needs to work on phones 2006 and later like the nokia 5300 with latest software
fyi i fill up values with the previous values with cookeis which do work ...
in PHP
Code:
<?php
header("Content-type: text/vnd.wap.wml"); // set the content type for WML
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // disable ALL caching
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo("<?xml version=\"1.0\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"(URL address blocked: See forum rules)\">\n\n");
?>
<wml>
<head>
<meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
</head>
<card title="SMA1">
<!-- Cabecera con el logo -->
Version 004 <br/>
<p> <small> Introduzca datos en el siguiente formulario: </small>
</p>
<!-- Datos CRD -->
<fieldset>
<?php
if(isset($HTTP_COOKIE_VARS["zxp"])) { // Check if TestCookie is set
$zxp = $HTTP_COOKIE_VARS["zxp"]; // Read the Cookies
$vxp = $HTTP_COOKIE_VARS["vxp"];
$dxp = $HTTP_COOKIE_VARS["dxp"];
$pxp = $HTTP_COOKIE_VARS["pxp"];
}
else {
$zxp ="";
$vxp ="";
$dxp ="";
$pxp ="";
}
?>
<p align="left">
<b> Zxxx: </b><input type = "text" format = "*N" name = "zxp" maxlength = "2" size = "2" value = "<?php echo $zxp; ?>"/> <br/>
<b> Vxxxx: </b> <input type = "text" format = "N" name = "vxp" maxlength = "1" size = "1" value = "<?php echo $vxp; ?>"/> <br/>
<b> Dxxxxx: </b><a name="dx_anchor"><input type = "text" format = "*N" name = "dxp" maxlength = "3" size = "3" value = "<?php echo $dxp; ?>"/></a> <br/>
<b> Pxxxxx: </b><input type = "text" format = "N" name = "pxp" maxlength = "1" size = "1" value = "<?php echo $pxp; ?>"/> <br/>
</p>
</fieldset>
<anchor>
<go href="process_data2.php" method="post">
<postfield name = "zx" value= "$zxp" />
<postfield name = "vx" value= "$vxp" />
<postfield name = "dx" value= "$dxp" />
<postfield name = "px" value= "$pxp" />
</go>
Enviar
</anchor>
<br/>
<!-- zxp 3 is [<?php echo $zxp ;
?>] -->
<script>
</script>
</card>
</wml>
-----------------------
page which is hit sets the cookies
Code:
//If input is OK
if(is_numeric($z) && is_numeric($v) && is_numeric($d) && is_numeric($p)
&& $z>0 && $v>0 && $d>0 && $p>=0 && strlen($z)<=2 && strlen($v)<=1 && strlen($d)<=3 && strlen($p)<=1
&& $z!="" && $d!="" && $v!="" && $p!=""){
$HTTP_COOKIE_VARS["zxp"] = $z;
setcookie ("zxp", $z ."", time()+60*60*24*90 );
setcookie ("vxp", $v ."", time()+60*60*24*90 );
setcookie ("dxp", $d ."", time()+60*60*24*90 );
setcookie ("pxp", $p ."", time()+60*60*24*90 );
echo "<!-- set cookie zxp to [" . $HTTP_COOKIE_VARS["zxp"] . "] -->";
$sql = "INSERT INTO Matrix_Values (Z, V, D, P) VALUES ($z, $v, $d, $p)
ON DUPLICATE KEY UPDATE P = $p;";
mysql_query($sql, $connection);
echo "<div align=\"center\">OK, data entered successfully";
}
else
{
echo "<div align=\"center\">KO, invalid data";
echo "You entered: z [$z] v [$v] d [$d] p [$p] ";
}
|