[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Need Forms Example

Posted on 2006-11-01
2
Medium Priority
?
328 Views
Last Modified: 2010-04-01
I have  a form that needs multiple buttons.  So far, I've been using one button for <submit>

  if button A is pushed then:  <input type="hidden" name="myVar" value="valueA">
  if button B is pushed then:  <input type="hidden" name="myVar" value="valueA">

<form action="/myAction">

     <html:submit property="action">SUBMIT</html:submit>

</form>

It needs to look like I have 2 submit buttons.  How do I do this?
0
Comment
Question by:tmonteit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
mhunts earned 1000 total points
ID: 17851474
You second button should set "valueB" not "valueA" I suppose.

Write two Javascript functions, one for each return value. Each function would set the appropriate return value.

For your first submit button, invoke the first Javascript. For the second submit button, invoke the second Javascript.
0
 

Author Comment

by:tmonteit
ID: 17851646

WOW!  I need some real help then.  Appologies for my frustration.  My post is a result of abandoning that type of solution.

I had tried something like that.  (code below)  It does JACK.    I can't debug it.  I can't make it print anything anywhere!!?? to see why the heck it won't work.    

I was hoping I might be able to do some simple tag-like solution.

If you can help with this one, I would be VERY thankful.

------------BEGIN WEB PAGE ----------
<script language="JavaScript" type="text/javascript" src="common.js"></script>

<input type="button" value="<bean:message key="common.save"/>" onclick="doPost(document.trainingHistoryForm, 'trainingHistory.do', 'save', null, null, null);">
------------END WEB PAGE ----------

------------BEGIN common.js ----------
function doPost(form, action, dispatch, param1, value1, anchor) {

      // Get the form action url
      var url = constructURL(action, dispatch, param1, value1, anchor);

      // Set it on the form and submit
      System.out.println("CommonJsp_1: url=" + url);
      document.write("CommonJsp_2: url=" + url);
      out.println("CommonJsp_3: url=" + url);
      
      form.action = url;
      form.submit();

}

function constructURL(action, dispatch, param1, value1, anchor) {

      var url = action;
      var nextSeperator = '?';
      if (dispatch != null) {
            url += (nextSeperator + 'dispatch=' + escape(dispatch));
            nextSeperator = '&';
      }
      if (param1 != null) {
            url += (nextSeperator + escape(param1) + '=' + escape(value1));
      }
      if (anchor != null) {
            url += '#' + escape(anchor);
      }
      return url;

}

------------END COMMON common.js ----------
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

649 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