?
Solved

<input type="button"> fails to pass name="" and value=""

Posted on 2003-11-18
8
Medium Priority
?
550 Views
Last Modified: 2013-12-03
I am writing a shopping cart application that uses both select boxes and buttons on the same page to submit variables and values to a Perl script.  I am using javascript to submit information to the script.  I have created a script that I have confidence accurately reads what is being passed thru the browser to the application and find that the select boxes work fine but the buttons fail to pass their information.  

Here are sample select and button tags.

<select name="choice1" onChange="javascript:document.workorder.submit()">
<option value="choose" selected>Choose Service:
<option value="men">Men's
<option value="women">Women's
<option value="summarize">Review Order
<option value="checkout">Check Out
</select>

<input type="button" name="b1" value="Clear All" onclick="javascript:document.workorder.submit()"><input type="button" name="b2" value="Subtotal" onclick="javascript:document.workorder.submit()"><input type="button" name="b3" value="Add To Order" onclick="javascript:document.workorder.submit()"><input type="button" name="b4" value="Check Out" onclick="javascript:document.workorder.submit()">

I find that the buttons do submit all other information to the Perl script,  just not their name-value pair.

Mercy!

0
Comment
Question by:Shearer-Services
7 Comments
 
LVL 5

Expert Comment

by:DesertWarrior
ID: 9771613
you should create a function to separate each action...

<input type="button" name="b1" value="Clear All" onclick="CallPage(1)"><input type="button" name="b2" value="Subtotal" onclick="CallPage(2)"><input type="button" name="b3" value="Add To Order" onclickonclick="CallPage(3)"><input type="button" name="b4" value="Check Out" onclick="CallPage(4)">


function CallPage(action)
{
if (action == 1) //meaning the user clicked on Clear All
{
      document.workorder.action = NameOfThePageToCall.asp?action=1
      document.workorder.submit()
}
if (action == 2) //meaning the user clicked on SubTotal
{
      document.workorder.action = NameOfThePageToCall.asp?action=2
      document.workorder.submit()
}
if (action == 3) //meaning the user clicked on Add To Order
{
      document.workorder.action = NameOfThePageToCall.asp?action=3
      document.workorder.submit()
}
if (action == 4) //meaning the user clicked on CheckOut
{
      document.workorder.action = NameOfThePageToCall.asp?action=4
      document.workorder.submit()
}
}

and then on the Page that receives all the information you do a Request.Querystring("action") to know the value and to be able to manage what do to...
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9771651
>>>onclickonclick="CallPage(3)"><

should be (and probaly a typo) onclick="CallPage(3)"
0
 
LVL 5

Expert Comment

by:DesertWarrior
ID: 9772095
yeah
i'm a ctrl C, ctrl V maniac
thanks :)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Shearer-Services
ID: 9772471
So if I answer my own question, do I get the points?  LOL

I pulled the code out of the script to remove any other conflicts that might cause the problem and created a new page.  By changing the input tag type to submit and removing the onclick="java*" I can now pass name-value pairs for all controls and related variables.   The changed portion of the code looks like this:

<input type="submit" name="b1" value="Clear All" >
<input type="submit" name="b2" value="Subtotal" >
<input type="submit" name="b3" value="Add To Order">
<input type="submit" name="b4" value="Check Out">

Thanks for the help.
0
 
LVL 5

Expert Comment

by:DesertWarrior
ID: 9773250
:/
this is a weird way of programming
anyways,
u do as u wish
0
 
LVL 35

Expert Comment

by:YZlat
ID: 9778997
are your <select> and buttons inside the <form> tags?
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 9800063
PAQed, with points refunded (250)

Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question