View Full Version : Difficulties with my form - please help !

06-06-2006, 06:18 PM
Is it ok to mix doc.getElementById stmts
with document.main_fm.upLoad1.value stmts im the same form. ?

This is what I am trying to do below but my onclick cmd doesn't change the contents of the browse box (it should clear it).

<form name="main_fm" enctype ="multipart/form-data" action="a_picts.php" method="POST">
<input type = 'hidden' name='run' value="on">
<input type="hidden" name ="MAX FILE SIZE" value="500000">
<input type = 'hidden' name='adref' value="<?php echo $A_ref ?>">

<div style='position:absolute; left:40px; top:320px' >
<b>First image:</b><br />
<input type="file" size="50" id = "u1" name="upLoad1" onchange="showImg1()"><br />
<input type="text" size="50" id = "n1" name="fName1" readonly>
<input type="button" value ="reset" onclick="document.getElementById('u1').value='';document.main_fm.upLoad1.value='';document.getElementById('im age1').src='';document.getElementById('image1').style.display='none'">

<div style='position:absolute; left:500px; top:262px' >
<img height='160' width='160' id="image1" style='display:none' />

I tried using a type=submit - which worked (it cleared the boxes) but then it went and submitted the form - which I diddn't want to happen !

Any ideas about where I am going wrong ?

06-06-2006, 07:39 PM
Yes you can mix them.

What are you trying to do though?

It looks like you reset the form and want to change a picture. I don't think you can change the value of a <input type="file"> form field as a security precaution.