Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    May 2006
    Thanked 4 Times in 4 Posts

    Difficulties with my form - please help !

    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('image1').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 ?

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Thanked 8 Times in 8 Posts
    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.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts