Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8995569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:38:15+00:00 2026-06-15T23:38:15+00:00

Possible Duplicate: Javascript add delete row sends form instead of adding row I have

  • 0

Possible Duplicate:
Javascript add delete row sends form instead of adding row

I have a page with two forms.

One form simply has one hidden input element, used to help concatenate a query string.

In the other form, I have a simple button element (not input type submit button) and the idea is to submit the other form onclick (using JavaScript). The button is in this form.

As it stands (for testing purposes), all I am doing at the moment is calling a JavaScript function called changeSpec(), wherein the absolutely only line of code is an alert box that shows me the value of the hidden input element.

The button:

<td class="entry" colspan="3"><button onclick="changeSpec()">Change Species</button></td>

The form with the hidden input element:

<form id="specChange" action="" method="get"><input id="hiddenSpec" type="hidden" value='@oppSpec' /></form>

The JavaScript function:

function changeSpec() 
{
    alert($("#hiddenSpec").val());
}

When I click the normal button element, I get a server-side error (YSOD)… I mean, WOW, didn’t see that coming, lol.

The error I get is unrelated to this, as it is some casting error in a query string I still have to sort out (this YSOD occurs, at the moment, any time the big form [not the one shown above] is submitted). Also this YSOD is a runtime error, not a compiler error, because the page loads no problem, until it thinks it is submitted, and the IsPost branch is subsequently executed.

Anyway, I can tell that somehow (even when I set onclick=””), that this button, which does reside in the big form, is actually trying to submit the form?

Not only have I used regular button elements in other forms before, and have always thought a regular button could never submit a form, I have also cleared the cache, several times, just to make sure nothing goofy (on that level) is going on. Anyway, it seems I am in need of an education pertaining to just how a normal button element can be interpreted by an html form.

Please help, I am truly at a loss here. How is this possible?

Thanks, and let me know if more code is needed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:38:16+00:00Added an answer on June 15, 2026 at 11:38 pm

    From the W3C button wiki page:

    The missing value default [for type] is the Submit Button state.

    In other words, any button without a type attribute is a submit button and will submit the form by default. Change your code to <button type="button" onclick="...">

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: JavaScript: formatting number with exactly two decimals Can some one please help
Possible Duplicate: how to add items to an array dynamically in javascript I'm adding
Possible Duplicate: How to merge two arrays in Javascript Let's suppose I have 2
Possible Duplicate: JavaScript Array Delete Elements So, in javascript, I have this set up:
Possible Duplicate: JavaScript Function Definition in ASP User Control Hi, I have a generic
Possible Duplicate: Javascript function to add X months to a date I'd like to
Possible Duplicate: Delete an array key when it contains a string in javascript by
Possible Duplicate: Javascript expression to define object’s property name? I'm trying to add objects
Possible Duplicate: JavaScript: string contains I have a postcode variable and want to use
Possible Duplicate: How do I add a property to a Javascript Object using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.