codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  javascript and jsp  vu at 14:39 on Wednesday, November 03, 2004
 

Hi,
I saw your article posted on codetoad.com about form with multi buttons
each does different thing. I am new to jsp and javascript please help
I have a jsp that has 2 buttons. One button when click it will collect customer name and shippng address and put them into a bean - order. then this order bean will put into a hashtable. The other button if click will send the hashtable away. I based on your article and do like this but it doesnot work.
<%@ page errorPage="/error.html" import="java.util.*, samples.*" %>
<% Order order = new Order();
Hashtable ht = new Hashtable();
%>
<html>
<head>
<title>Main Order</title>
</head>
<body bgcolor="white">
<hr>
<hr>
<form onSubmit="return getHashtable(this)" method="post" name="myForm" action="" >
<table border="2" align="center" cellpadding="12" bgcolor="yellow">
<tr><th bgcolor="blue"><img src="/forum/view/saic_s2s2.gif"></th></tr>

<tr><td align="center">
Customer Name : <input type="text" name="customerName"><br>
<tr><td align="center">
Shipping Address: <input type="text" name="shippingAddress"><br>
<hr>
<center>
<input type="button" onClick="getHashTable()" name="Submit1" value="Add-Order">
<input type="button" onClick="getHashTable()" name="Submit2" value="Complete-Order">
</center>
</table>
</form>
<hr>
<hr>
</body>
<SCRIPT LANGUAGE="JavaScript">
function getHashTable() {
order.setCustomerName(document.myForm.customerName.value);
order.setShippingAddress(document.myForm.shippingAddress.value);
ht.put(order.getCustomerName(), order);
if (target == 0) document.myForm.action="/forum/error.html";
if (target == 1) document.myForm.action="/axis/ClientServletChain";
return true;
}

</SCRIPT>
<html>

Any one please help.
Thanks in advance
vu


  Re: javascript and jsp  tgreer at 15:24 on Wednesday, November 03, 2004
 

Here's what is going on (wrong) in your page:

1) You have the form calling a function "onSubmit", but you don't have any submit buttons on the form.

2) You have buttons calling a function "onClick", but they aren't passing any arguments into the function.

Resolution:

1) remove the onSubmit() handler from your form.
2) add keyword "this" to function calls on the buttons.

Revised sample:


<html>
<head>
<title>Main Order</title>

<SCRIPT LANGUAGE="JavaScript">
function getHashTable(x)
{ alert(x.name)
}

</SCRIPT>


</head>
<body bgcolor="white">
<hr>
<hr>
<form method="post" name="myForm" action="" >
<table border="2" align="center" cellpadding="12" bgcolor="yellow">
<tr><th bgcolor="blue"></th></tr>

<tr><td align="center">
Customer Name : <input type="text" name="customerName"><br>
<tr><td align="center">
Shipping Address: <input type="text" name="shippingAddress"><br>
<hr>
<center>
<input type="button" onClick="getHashTable(this)" name="Submit1" value="Add-Order">
<input type="button" onClick="getHashTable(this)" name="Submit2" value="Complete-Order">
</center>
</table>
</form>
<hr>
<hr>
</body>

<html>


Additional steps for you:

Based on the value of the "name" of the button that was clicked ("this.name" in your function), set your various values and actions (just as in your orginal function) and also do a form.submit() to get the form to post to the server.

Thomas D. Greer
www.tgreer.com



  Re: javascript and jsp  vu at 16:14 on Wednesday, November 03, 2004
 

I haven't try this. but first thing first: Thanks a lot
vu

  Re: javascript and jsp  wwwkan123 at 06:21 on Friday, June 24, 2011
 



Today I found a wonderful website,the site contained:

wedding dresses


cheap wedding dresses


Junior Bridesmaid Dresses


Cheap Homecoming Dresses


Cheap Quinceanera Dresses


Inexpensive bridesmaid dresses


Wholesale wedding dress


Wholesale wedding dress


Discount wedding dresses


Cheap Maternity Wedding Dresses


A-Line Wedding Dresses


Cheap Couture Wedding Dresses


Cheap Beach Wedding Dresses


Cheap Casual Wedding Dresses


Cheap Simple Wedding Dresses


Cheap Modest Wedding Dresses


Cheap Special Occasion Dresses


Cheap Evening Dresses


Cheap Prom Dresses


Cheap Little Black Dresses


Cheap Plus Size Wedding Dresses


Pink Wedding Dresses


Cheap Wedding Party Dresses


Cheap Bridesmaid Dresses


Cheap Flower Girl Dresses


Cheap Mother of the Bride Dresses

victoria's secret,

cheap wedding dresses,wholesale wedding dress,Wedding dresses 2011,Plus Size Wedding Dress wholesale,Couture Wedding Dress wholesale,Formal Wedding Dress wholesale,Bridesmaid Dresses wholesale,Discount Bridesmaid Dress wholesale,Junior Bridesmaids Dresses wholesale,Maternity Bridesmaid Dress wholesale,Cocktail Dress wholesale,Prom Dress wholesale,Evening Dress wholesale,Sexy Evening Dress wholesale,Stardoll Dress wholesale,Quinceanera Dress wholesale,Mother of the Bride Dress,Flower Girl Dress,Wedding Accessories wholesale


  Re: javascript and jsp  breakfastfood09 at 07:08 on Monday, August 01, 2011
 

A century ago, American farmers healthy breakfast and city-dwellers alike piled breakfast low calorie diet plan plates high with meat, potatoes, gravy, eggs, bread, and healthy breakfast ideas/strong> sometimes pastries. Not much has eggs breakfast recipe changed.A 21st century leisurely breakfast often healthy breakfast foods consists of sausage or bacon, eggs, fried potatoes, gravy, healthy breakfast cookie recipe and waffles or pancakes smothered healthy breakfast cereal choices in butter and syrup or topped with healthy breakfast recipes sweetened fruit compote low calorie breakfast recipes and whipped cream.This breakfast is high in saturated fat and low in vitamins and healthy breakfast diet for kids other important nutrients. People who engage average breakfast cereal choices in regular hard work similar to healthy breakfast choices our ancestors, like the Amish, might get away with diet breakfast recipes eating that diet, but the rest of healthy eating tips America is at healthy breakfast dishes for kids increased risk of obesity and chronic diseases, such as cancer and diabetes.Another typical breakfast hurriedly gobbled down healthy recipes for weight loss before children and adults rush out the door is breakfast recipes for kids a bowl of sugar-coated cereal. An alternate version is a pastry and a cup of Tips for Healthy Eating coffee. These foods are highly processed and Breakfast and Brunch Cookbook high in sugar. They fill the void and give you a healthy indian breakfast recipe quick flash of energy, but the effect is short lived. By healthy brekfast foods for girls mid-morning, you're tired wrap sandwich recipes and hungry. Not only are you Real Food for Healthy Kids consuming empty calories, but you're also increasing your risk of diabetes healthy breakfast menus kids and obesity.Eating regular meals — especially breakfast — every day is a good health habit. Breakfast kick-starts your metabolism, healthy snack foods kids provides fuel for your healthy snacks kids mind, and healthy breakfast fruits for kids cuts down on mid morning snacking. Most snack foods are breakfast and brunch cookbook morning high in calories, fat, sugar, easy breakfast casserole and salt, and low in nutrients. This is probably one reason why pictures of healthy food breakfast skippers tend to weigh more healthy food habits.

  Re: javascript and jsp  breakfastfood09 at 07:14 on Monday, August 01, 2011
 

A century ago, American farmers healthy breakfast and city-dwellers alike piled breakfast low calorie diet plan plates high with meat, potatoes, gravy, eggs, bread, and healthy breakfast ideas/strong> sometimes pastries. Not much has eggs breakfast recipe changed.A 21st century leisurely breakfast often healthy breakfast foods consists of sausage or bacon, eggs, fried potatoes, gravy, healthy breakfast cookie recipe and waffles or pancakes smothered healthy breakfast cereal choices in butter and syrup or topped with healthy breakfast recipes sweetened fruit compote low calorie breakfast recipes and whipped cream.This breakfast is high in saturated fat and low in vitamins and healthy breakfast diet for kids other important nutrients. People who engage average breakfast cereal choices in regular hard work similar to healthy breakfast choices our ancestors, like the Amish, might get away with diet breakfast recipes eating that diet, but the rest of healthy eating tips America is at healthy breakfast dishes for kids increased risk of obesity and chronic diseases, such as cancer and diabetes.Another typical breakfast hurriedly gobbled down healthy recipes for weight loss before children and adults rush out the door is breakfast recipes for kids a bowl of sugar-coated cereal. An alternate version is a pastry and a cup of Tips for Healthy Eating coffee. These foods are highly processed and Breakfast and Brunch Cookbook high in sugar. They fill the void and give you a healthy indian breakfast recipe quick flash of energy, but the effect is short lived. By healthy brekfast foods for girls mid-morning, you're tired wrap sandwich recipes and hungry. Not only are you Real Food for Healthy Kids consuming empty calories, but you're also increasing your risk of diabetes healthy breakfast menus kids and obesity.Eating regular meals — especially breakfast — every day is a good health habit. Breakfast kick-starts your metabolism, healthy snack foods kids provides fuel for your healthy snacks kids mind, and healthy breakfast fruits for kids cuts down on mid morning snacking. Most snack foods are breakfast and brunch cookbook morning high in calories, fat, sugar, easy breakfast casserole and salt, and low in nutrients. This is probably one reason why pictures of healthy food breakfast skippers tend to weigh more healthy food habits.

  nice  danaray79 at 19:44 on Tuesday, August 02, 2011
 

I must appreciate you for the information you have shared.I find this information very useful and it has considerably saved my time.thanks

Buy Articles | Life Experience Degree | bachelor degree | Sample Essays








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Open hidden window from Pop-up
•  Re: how to convert wav file to text file
•  Re: Date validation
•  Re: open new window from pop up menu
•  Re: GET METHOD
•  Re: document.images Syntax error
•  Re: Vertical and Horizontal Image Scroller
•  Re: Form - setting limits & summing values in drop down menus
•  Re: button software


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011