I have a form which has a table and cells which I have programmed to edit but when I hit the submit key the form gets submitted

I only want the cell to accept the enter key and the form should not get submitted at all as I am using ajax to update the cell contents
goodkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
The form submit button should call your javascript function when it's clicked. Like this:
<input type="submit" name="Submit" value="Submit" onclick="myJavaScriptFunction()"/>
0
goodkAuthor Commented:
So I have to differentiate where the cursor is when enter is clicked?
0
goodkAuthor Commented:
Is there a comprehensive example how to handle this?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Brian TaoSenior Business Solutions ConsultantCommented:
Add onsubmit="return false" in your form tag then you're good.
0
goodkAuthor Commented:
http://right-match.com/testit.aspx

I am doing something dumb; can't figure it out.  Please see if you can help

See all I need help when I hit the enter key when editing to not submit the form but just the table cell
0
Dave BaldwinFixer of ProblemsCommented:
The standard operation of forms for the past 20 years has been that if you press enter while you are in any of the fields in the form, the form will be submitted.  That is normal.  You have to include some javascript if you want to suppress that operation.  Brian's onsubmit="return false" will do it in a simple way that covers that whole form.
0
goodkAuthor Commented:
I thought I had that
0
Dave BaldwinFixer of ProblemsCommented:
You haven't shown us any of your code so we can see what you're doing.
0
goodkAuthor Commented:
<body>
    <form id="form1" onsubmit="return false" runat="server">
    Edit:
    <input id="EditCheckbox" runat="server" onclick="form1.submit()" type="checkbox"  value="Edit" />
    <div class="verticalScroll">
        <%
            HttpContext.Current.Session["Application"] = "rightmatch";


            Response.Write(xrun());%>
    </div>
    </form>
</body>
0
goodkAuthor Commented:
can you do source on the link I have?  I basically have ajax called when the table cell is hit.  My problem is that the form keeps getting submitted after I hit the cell and put text and hit the Enter key
0
Dave BaldwinFixer of ProblemsCommented:
I think you'll find that onclick="form1.submit()" bypasses onsubmit="return false".

Of course, why are you hitting the Enter key?  Like I said above, for the last 20 years, forms have always been submitted when you press Enter in one of the form fields.
0
Dave BaldwinFixer of ProblemsCommented:
I just looked at the source for your page.  Since you are using 'Viewstate', I'm not sure you can change any of that behavior.
0
goodkAuthor Commented:
Well, all the javascript is visible and I do not understand what could trigger the form into submit

When text field is on for edit why it would not only submit that cell?  What else is there on the form which is making it submit??
0
goodkAuthor Commented:
http://right-match.com/test/autocomplete.aspx

I tried the above and it works.  Did not change the viewstate.

So may be something is wrong with my original form.  Let me work on it and narrow the problem down before i revert to you experts
0
Dave BaldwinFixer of ProblemsCommented:
You might want to click on "Request Attention" and get some others to look at your question.  I think that using Viewstate complicates the problem.
0
Brian TaoSenior Business Solutions ConsultantCommented:
Ah.... it's asp.  Remove the  runat="server" part from your form tag and see if it works.

And if you're trying something interactive that only happens on the client side, remove those  runat="server" from the input tags too.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
goodkAuthor Commented:
I did remove the runat="server" and it did not help.

asp.net is so frustrating.

Hate it. Wish I could turn off all the functionality of asp.net and just use c# and javascript to do my work.
0
goodkAuthor Commented:
This problem is not resolved but the expert did answer the question
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.