Jul 25, 2008

Submit Button

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Submit Button

kvarnerexpress
I have a form on my page. I do not have a submit button, but when I hit enter on my text field, it is like I am clicking on a submit button. My page refreshes to the original state, and my values are reset.

I found this out because I made a submit button and tried it.

Is there a way to get around this? I am trying to use a javascript that captures the key strokes. That works, but then the submit like event still fires after my code runs, nullifying any changes my code has made.

html4strict Code:

CODE
1.
     <form name="FormPictureInfo">
  2.
         <table cellpadding="0" cellspacing="4" border="0" align="center">
  3.
             <tr>
  4.
                 <td align="center"><input type="text" name="ProductCode" size="22" maxlength="256" value="default" onFocus="clearBox(this);" /></td>
  5.
                 <td align="center"><div class="infotitle">Product:</div></td>
  6.
                 <td align="center"><div class="infotitle">Comments:</div></td>
  7.
                 <!--<td align="center"><div class="infotitle">Picture Date:</div></td>-->
  8.
                 <td valign="top" align="center"><div class="Descriptor" id="BagSize">Bag Size</div></td>
  9.
             </tr>
 10.
             <tr>
 11.
                 <td><table cellpadding="2" cellspacing="6" border="0">
 12.
                     <tr>
 13.
                         <td valign="top" align="center"><input type="button" value="Display Picture" onclick="FillDataShowPic(document.FormPictureInfo.ProductCode.value);"/></td>
 14.
                     </tr>
 15.
                     <tr>
 16.
                         <td valign="top" align="center"><input name="ZoomButton" type="button" value="ZOOM" onclick="Zoom(document.getElementById('ProductCodeDisplay').innerHTML);"/></td>
 17.
                     </tr>
 18.
                 </table></td>
 19.
                 <td valign="top"><table cellpadding="0" cellspacing="2" border="0">
 20.
                     <tr>
 21.
                         <td align="center"><div class="Descriptor" id="ProductName">Product Name</div></td>
 22.
                     </tr>
 23.
                     <tr>
 24.
                         <td align="center"><div class="Descriptor" id="ProductCodeDisplay">Product Code Display</div></td>
 25.
                     </tr>
 26.
                     <tr>
 27.
                         <td valign="top" align="center"><div class="Descriptor" id="PictureDate">Picture Date</div></td>
 28.
                     </tr>
 29.
                 </table></td>
 30.
                 <td valign="top" align="center"><div class="DescriptorArea" id="ProductComments">Product Comments</div></td>
 31.
                 <td><table cellpadding="0" cellspacing="2" border="0">
 32.
                     <tr>
 33.
                         <td align="center"><div class="Descriptor" id="SetPoint">Set Point</div></td>
 34.
                     </tr>
 35.
                     <tr>
 36.
                         <td valign="top" align="center"><div class="Descriptor" id="Density">Density</div></td>
 37.
                     </tr>
 38.
                     <tr>
 39.
                         <td valign="top" align="center"><input type="button" value="Close" onclick="self.close();"/></td>
 40.
                     </tr>
 41.
                 </table></td>
 42.
             </tr>
 43.
         </table>
 44.
         </form>



Thanks,kvarnerexpress

 

 

 


Reply

cse-icons
If I understand properly, u do not wish the form to submit on "Enter".
To prevent this you can have a

CODE

<form action="" onSubmit="func()">


The onsubmit event would fire on pressing enter, which would call the javascript function "func()". In this function u can do the processing and submit if u want or else just leave it.

Cheers.

Reply

Lozbo
QUOTE(cse-icons @ Aug 31 2005, 01:06 AM)
CODE

<form action="" onSubmit="func()">

*


I think you could also put a submit button with the atribute

CODE

... <input type="submit" onClick="func()">...


which is suposed to do exacly the same (even if you omit the 'onSubmit' atribute on the form tag).

Reply

reatum
all you need to do to keep the form from submitting on enter is
CODE

<form name="whatever" onSubmit="return false;">


then use javascript to tell your form what to do with some sort of listener or an onclick function on a submit button like lozbo said.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : submit, button

  1. About Submit Form Box
    (8)
  2. Multiple Drop Down Menus W/ Submit Button
    (6)
    I am building a page that will have 2 drop down menus and a submit button. The first menu will have
    one set of options, say colors (red, blue, green, yellow). The second menu will have another set of
    options, say sizes (small, medium, large). What I want to be able do is select a color and a size,
    click submit and have it go to the page for those options. So if a user picks 'Red' and
    'Small' and clicks submit they will be linked to page1.html. If they pick 'Blue' and
    'Large', they will be linked to page2.html, and so on. Any ideas how to ....
  3. Dynamic Button Size
    (1)
    In my application I have a custom tag that generates all the action buttons that the page needs. My
    problem is that in IE the space between the left side of the button and the image inside the button
    are not consistant. Some buttons have 3 or 4 more pixels of padding on the left side then others.
    This causes my buttons to be too large and hence the area the buttons are generated in stretches too
    far. I could wrap the buttons around to another line or add scroll bars.. but if it will fit in FF I
    think it should fit in IE as well. So my question is can I set the padding....
  4. Xhtml Strict Method For Submit/reset Buttons As An
    (1)
    What's the proper way to handle submit and reset buttons? Using type submit and reset don't
    allow you to replace the default button with an image, using the type image doesn't allow a
    button to automatically act like a submit or reset....so far as I know. So How should I do this
    when I want to use a custom image as the button? Code will be best way to explain, thanks! ....
  5. Refresh Page After Back Button Hit
    (11)
    Hi. I have a page that is dynamically build through DOM manipulation. So, when I browse outside the
    page, and then click back, those dynamically created DOM objects are gone. Since I am also using JSP
    / Servlet technology, I can rebuild this page easily, which I have done. Here is my dilemma. If
    the user leaves the dynamic page, then clicks back on their browser, I need the page they are going
    back to to refresh. I can't figure out how to do this. I've tried using the META tag, but it
    won't do it. Help would be appreciated. Thanks. ....
  6. Radio Button
    (4)
    I am trying to maintain the radio button selection on a Submit, but the form refreshes to its
    default selection. BTW, After a Submit is clicked, the radio form stays visible on the top of the
    screen while the query results are displayed on the bottom half of the screen (we're using an
    internal, embedded link). That's when the default selection comes into place. Any help would be
    appreciated. Please respond Kvarnerexpress.....
  7. Substitute Form Button For An Image
    homemade images in forms buttons (3)
    Hi, I have the next formular : CODE  <form method='post'
    action='index.php?mode=2&id=1'>                <input type='hidden'
    name='name' value='Canon Digital Ixus 700'/>                <input
    type='hidden' name='id' value='1'/>                <input
    type='hidden' name='qty' value='1'>                <input
    type='hidden' name='cost' value='40'>                <input
    type='submit' value='Add to ca....
  8. Button To Print Current Web Page
    (13)
    Hi, Does anyone know how to create a button that will printo out the current page. What I want to
    do is have the user fill out a form (containing name, address, zip, etc). They will then click on a
    "print" button and it will print out the form data. Any ideas? Thanks.....
  9. Enter Keypress Submits Wrong Button
    (2)
    Ive got a form, with a submit button on the left and a submit button on the right. By default on the
    enter keypress, the form submits the left submit button, but i want it to submit the right button.
    How would i accomplish this? kvarnerexpress....

    1. Looking for submit, button

Searching Video's for submit, button
advertisement



Submit Button



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE