SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submitting a form, without submitting it

    I have a search form.
    Now on this form is many fields.

    There are 3 fields (select boxes) that when clicked, need to submit the form, store the data in a temporary table, then rebuild the form with that data and draw 2 new drop downs where text fields used to be.

    Now, I can do most of that. The problem lies in redrawing the form (the page will refresh).

    I could submit the form using onChange event with the drop down (which is what i was planning) and form.submit javascript.

    My problem lies with if the user hits enter on a field. If they do, the submit buttons variable won't be set, and it'll just reresh my form and the user will be stuck wondering where the search results are.

    So, what I'm asking is would it be better to disable enter key, or is there another way to make the page refresh from the database by just clicking on an item in a select box?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You could make your form submit when a select box was changed, then populate the other dropdowns using data you collect from your DB. The code on the first <select> would go something like this:
    Code:
    <form id="form1" action="samepage.php" method="post">
    <select id="myselect" onchange="this.form.submit();">
      <option value="1">My Option</option>
    </select>
    </form>

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats exactly what I had planned.

    But if the user changes the drop down, the form should repopulate, if the user hits submit, the search results should come up.

    This is my problem. If they hit enter on a search field, it'll just repopulate the form, and not give the results.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, and for some reason this.form.submit() is returning "Object does not support this property or method"

    =\
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No one?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This one pops up once a month or so. Every Form object sports a .submit() method, so the only reason for that error message is:
    Code:
    <input type="submit" name="submit">
    ...which neatly replaces Form.submit (the function) with Form.submit (the button). Just change it, or omit it altogether.
    ::: certified wild guess :::

  7. #7
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh. I see.
    Thanks.

    Now that that's out of the way, what about my original question:
    So, what I'm asking is would it be better to disable enter key, or is there another way to make the page refresh from the database by just clicking on an item in a select box?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  8. #8
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Remove the submit button. Place an ordinary button & specify the onClick event handler with "this.submit()". So that the ordinary button acts as a submit button & I think that if a submit button is not included in a form, its not submitted even when ENTER key is pressed.


    If that doesn't works, disable the ENTER key, its works with forms only in IE.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  9. #9
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thanks. I'll try that.

    And it being IE only isn't a problem as this is for a company webapp, and IE is the only browser allowed.

    Edit:

    Yap, without the input type of submit, the enter key doesn't submit the form. You just get a "ding" error sound.
    Thanks!
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  10. #10
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Though now, I get "Object does not support this property or method" error again.

    Can a form not have 2 objects in it that could submit the form?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  11. #11
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sure there can. There's no hard & fast rule which states that there can only be one form object that submits a form.

    It'd be better if you can post the code. That way the error can be found instead of posting wild guesses. Finding an error in a script on the basis of just error description is as safe as target practice in dark.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  12. #12
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, but be warned, it's not small

    HTML Code:
    <html>
    <title>ReDI SearchEngine </title>
    <link rel="stylesheet" type="text/css" href="/redi/inc/style/redi.css">
    </head>
    <body bgcolor="#CCCCCC" text="#666666" link="#003366" vlink="#003366" alink="#003366" >
    
    <script type="text/javascript">
    function showimage()
    {
    	if (!document.images)
    	return
    	document.images.pictures.src = '/redi/inc/img/dba/' + document.db_search.user_id.options[document.db_search.user_id.selectedIndex].value + '.jpg'
    }
    </script>
    <fieldset style="padding: 5px;"><legend><span class="form_header">Search for Node Deails</span></legend>
    <form action='SearchAdvancedProcess.jsp' method='post' name='db_search' id='db_search'>
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#CCCCCC' width='90%' align='center'>
     <tr bgcolor='#eeeeee' class='form_header'>
      <td colspan='3' align='center' valign='middle'>Enter or select each value you wish to search on.<br/>Click the checkbox next a field to enable a partial search on that field.
      </td>
     </tr>
    </table>
    <br />
    <div id="engine_details">
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>Engine Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Engine Name</b></td><td width="50%"><select name="sftw_prod_id"/><option value="0">No specific engine</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
      <tr>
      <td width="50%" align="right"><b>Engine Version</b></td><td width="50%"><select name="sftw_prod_vrsn_id"/><option value="0">No specific engine version</option><option value="0">&nbsp;</option>
      </select></td>
     </tr>
    </table>
    </div>
    <br/>
    <div id="node_details">
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>Node Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Node Name</b></td><td width="50%"><select name="node_id" onChange="this.form.submit();"><option value="0">No specific node name</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Node Type</b></td><td width="50%"><select name="node_typ_cde"><option value="0">No specific node type</option><option value="0">&nbsp;</option>
    <option value="3" >logical node (lpar)</option><option value="2" >logical node (non-lpar)</option><option value="1" >machine = node</option><option value="5" >machine only (lpar)</option><option value="4" >machine only (non-lpar)</option><option value="99" >unknown</option>  </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Operating System Name</b></td><td width="50%"><select name="os_nme"><option value="0">No specific OS</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>OS Version</b></td><td width="50%"><select name="os_vrsn_nme"><option value="0">No specific OS Version</option>><option value="0"></option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>CPU Quantity</b></td><td width="50%"><select name="cpu_qty"><option value="0">No specific CPU quantity</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Node Location</b></td><td width="50%"><select name="node_loc_cde"><option value="0">No specific location</option><option value="0">&nbsp;</option>
    </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Clusters</b></td><td width="50%"><select name="clstr_id"><option value="0">No specific Cluster</option>><option value="0"></option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Lpars</b></td><td width="50%"><select name="lpar_mch_id"><option value="0">No specific Lpar</option>><option value="0"></option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right" valign="top"><b>Date Created</b></td><td width="50%">Between
      <input type="text" name="node_crt_begin" maxlength="10" size="8" readonly >
      <a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=node_crt_begin','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')">
      <img src="downarrow.gif" alt="  Popup calendar  " border="0"></a> and 
      <input type="text" name="node_crt_end" maxlength="10" size="8" readonly >
      <a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=node_crt_end','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')">
      <img src="downarrow.gif" alt="  Popup calendar  " border="0"></a>
      </td>
     </tr>
    </table>
    </div>
    <br />
    <div id="server_details">
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>Server Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Server Name</b></td><td width="50%"><input type="text" name="db_srvr_nme"/></td>
     </tr>
      <tr>
      <td width="50%" align="right"><b>Enviroment</b></td><td width="50%"><select name="env_cde"><option value="0">No specific enviroment</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
     <tr>
      <td width="50%" align="right" valign="top"><b>Date Created</b></td><td width="50%">Between
      <input type="text" name="server_crt_begin" maxlength="10" size="8" readonly >
      <a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=server_crt_begin','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')">
      <img src="downarrow.gif" alt="  Popup calendar  " border="0"></a> and 
      <input type="text" name="server_crt_end" maxlength="10" size="8" readonly >
      <a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=server_crt_end','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')">
      <img src="downarrow.gif" alt="  Popup calendar  " border="0"></a>
      </td>
     </tr>
    </table>
    </div>
    <br/>
    <div id="db_details">
    <table cellpadding='0' cellspacing='1' border='1' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>Database Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Database Name</b></td><td width="50%"><input type="text" name="db_nme"/></td>
     </tr>
      <tr>
      <td width="50%" align="right"><b>Allocated Space</b></td><td width="50%">Between
      <input type="text" name="db_alloc_begin" maxlength="2" size="2"> MB and 
      <input type="text" name="db_alloc_end" maxlength="2" size="2"> MB
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>Used Space</b></td><td width="50%">Between
      <input type="text" name="db_used_begin" maxlength="2" size="2"> MB and 
      <input type="text" name="db_used_end" maxlength="2" size="2"> MB
      </td>
     </tr>
     <tr valign='bottom'>
      <td width="50%" align="right" valign="middle"><b>Date Created</b></td>
      <td width="50%" valign='bottom'>Between  <input type="text" name="db_crt_begin" maxlength="10" size="8" readonly ><a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=db_crt_begin','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')"><img src="downarrow.gif" alt="  Popup calendar  " border="0"></a> and 
      <input type="text" name="db_crt_end" maxlength="10" size="8" readonly >
      <a href="javascript:(void)" onClick="window.open('pop_cal.jsp?f=db_crt_end','Calendar','toolbar=no,scrollbars=no,resizable=yes,width=200,height=170')">
      <img src="downarrow.gif" alt="  Popup calendar  " border="0"></a>
      </td>
     </tr>
    </table>
    </div>
    <br/>
    <div id="app_details">
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>Application Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>SSG Name</b></td><td width="50%"><select name="ssg_cde"><option value="0">No specific SSG</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
      <tr>
      <td width="50%" align="right"><b>Application Name</b></td><td width="50%"><select name="appl_id"><option value="0">No specific application name</option><option value="0">&nbsp;</option>
    
      </select></td>
     </tr>
    </table>
    </div>
    <br/>
    <div id="dba_details">
    <table cellpadding='6' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='15%' align='left' valign='middle'>DBA Details</td>
         <td width='70%' align='center' valign='middle'></td>
         <td width='15%' align='center' valign='middle'>&nbsp;</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td width="50%" align="right"><b>DBA Name</b></td><td width="50%">
       <table width="50%" border="0" align="left">
        <tr>
         <td align="center"><select name="user_id" onChange="showimage()"><option value="0">No specific DBA</option><option value="0">&nbsp;</option>
         </td>
         <td align="center" valign="middle"><img src="/redi/inc/img/dba/0.jpg" name="pictures" width="99" height="100" border="0"></td>
        </tr>
       </table>
       </select>
      </td>
     </tr>
    </table>
    </div>
    <br/>
    <table cellpadding='5' cellspacing='1' border='0' bgcolor='#FFFFFF' width='90%' align='center'>
     <tr>
      <td colspan='3' align='center' valign='middle'>
       <table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr>
         <td width='100%' align='center' valign='middle'>Submit Form</td>
        </tr>
       </table>
      </td>
     </tr>
     <tr>
      <td colspan='3' align='center' valign='middle'>
      <input type='hidden' name='isSubmit' value='submit' />
      <input type='button' name='doSubmit' value='search' class='buttn' style='width:70' onClick='this.submit()'/>&nbsp;&nbsp;&nbsp;
      <input type='reset' name='cancel' value='reset' class='buttn' style='width:70'/></td>
     </tr>
    </table>
    </form>
    </fieldset>
    
    
    </body>
    </html>
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  13. #13
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code scared everyone off?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  14. #14
    SitePoint Evangelist NokX's Avatar
    Join Date
    Feb 2003
    Location
    Knoxville, TN
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't have a solution to your problem, but i noticed with the way you do your tags...some attributes are in single quotes, and some are in double quotes.

    Code:
    <td width='15%' align='left' valign='middle'>
    Code:
    <td width="50%" align="right">
    i'd try to be consistent, at least. although i prefer double quotes on all my attributes.

    sorry...just a little pet peeve of mine.

  15. #15
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Remove the submit button. Place an ordinary button & specify the onClick event handler with "this.submit()".
    this, inside a Button.onclick handler, refers to the Button object - not the Form object. Buttons don't have a .submit() method.
    Code:
    <input type="button" value="submit" onclick="this.form.submit()">
    There is no reason to do it this way, just thought I'd mention it.
    ::: certified wild guess :::

  16. #16
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    adios, you've got me rather confused now.

    What SHOULD i do then?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  17. #17
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Defender1
    Code scared everyone off?
    Definitely Not. I've coded pages heavier than this & also rectified errors in pages double-triple this size.

    But I'm afraid I won't be able to help you today, a lot of rush here today. But I'll look at it tomorrow if anyone else hasn't posted a solution or if you haven't got a solution by tomorrow.

    Till then, hold tight!!
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  18. #18
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Defender1...

    Well...I'm too. What was it you wanted to do, again?
    ::: certified wild guess :::

  19. #19
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Defender1
    adios, you've got me rather confused now.

    What SHOULD i do then?
    Ah!! Nothing to be confused in this.

    Simply put, place the following function between the <script></script> tags.
    Code:
    function subForm()
    {
    document.db_search.submit();
    }
    
    Just remember to change db_search to the form name if its not.

    Now change the button code to
    Code:
    <input type='button' name='doSubmit' value='search' class='buttn' style='width:70' onClick='javascript:subForm();'/>
    Simple & Easy.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  20. #20
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, i'll try that.

    Adios, what I need is to have 2 different ways to submit the form: 2 drop downs that'll submit it one way, and a submit button (that'll set a variable) as well.

    I need it this way to know which action to take. If the user changes one of the select boxes I need to populate a couple others, if they click submit i need to process the form data.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  21. #21
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What happened with the 'enter' key issue? (you can probably see why someone might be confused).

    To handle the problem you mentioned: submitting a form by calling its .submit() method does not call the Form.onsubmit handler. The idea, presumably, is that you're already programming this (a user can't call the submit() method - unless they type in a javascript&#58; url!) so, you don't need the onsubmit handler to trap the (user) event. You can use this to your advantage by setting a hidden field like so:
    Code:
    <form........onsubmit="used_button.value='yes'">
    <input type="hidden" name="used_button" value="no">
    ........
    <select......onchange="this.form.submit()">
    ......
    <input type="submit">
    </form>
    The hidden field's value will remain the same ("no") when the Select submits, but change when the button is used.

    http://www.dynamicdrive.com/dynamici...sableenter.htm
    ::: certified wild guess :::

  22. #22
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, i'm getting a bit perturbed now.

    I get "Object Expected" on the line with the search button now.

    Code:
    <script type="text/javascript">
    fuction subForm()
    {
    	document.db_search.submit();
    }
    </script>
    
    [...]
    
      <input type='button' name='submit_form' value='search' class='buttn' style='width:70' onClick='javascript:subForm();'/>
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  23. #23
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adios, per asp_funda's advice, removing the submit button (type='button' instead of type='submit') hitting enter no longer submits the form.

    Also, could I use your advice on a button's onClick event?

    Or does it just not really matter?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  24. #24
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="hidden" name="isSubmit" value="no" />
    <input type="button" name="doSubmit" value="search" class="buttn" style="width:70px;" onclick="isSubmit.value='yes';this.form.submit()" />
    ::: certified wild guess :::

  25. #25
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems to be working perfectly now.

    Thanks a bunch!
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

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