Marcelo a écrit :
Hi Erwin,
I need a roobot that fills a form, I already made that with php (
sending the url with values ) but i want to make the same thing on a
javascript page, so I don't know how to send the values
So when you write: "I want that php fills a javascript form", do you mean
you KNOW what values you want in the form?
Yes I know
to non visually display fields by javascript :
<?
/* php to set/get php _POST variables */
?>
<html>
<script type="text/javascript">
var fld = new Array();
fld[1] = '<? echo $field1 ?>';
fld[2] = '<? echo $field2 ?>';
function hideFields() {
var f = document.forms['form1'];
var j = 0;
for(var i=0;i<f.length;i++)
if(f[i].type == 'text') {
if(fld[j] != '')
f[i].style.display = 'none';
j++;
}
}
onload = hideFields;
function showHideField(fieldName,what) {
var f = document.forms['form1'].elements[fieldName];
if(f.style.display != 'none') {
f.style.display = 'none';
what.value = 'Show '+fieldName;
}
else {
f.style.display = 'inline';
what.value = 'Hide '+fieldName;
}
}
</script>
<form name="form1" action="myPhp.php" method="post">
<p>Field 1 : <input type="text" name="field1"
value="<? echo $field1 ?>">
</p>
<p>Field 2 : <input type="text" name="field2"
value="<? echo $field2 ?>">
</p>
<p><input type="submit" value="Send">
</p>
<p><input type="button" value="Show/Hide Field 1"
onclick="showHideField('field1',this);">
<input type="button" value="Show/Hide Field 2"
onclick="showHideField('field2',this);">
</p>
</form>
</html>
--
Stephane Moriaux et son [moins] vieux Mac