Two buttons in one form?

hi,
i wanted to know if i place 2 buttons in one form, the form will submit to the same page either way, is there any way on the second page to detect which button was clicked? suppose the form sends for info on a person but i need to know which button was clicked on the other end to display other data, is it possible to know which one was clicked?
Thank you.

If you name the buttons the same, but assign them different values, you could check the value of the parameter with the button's name to determine which button was clicked. Alternatively, you could set up a hidden field called something like "buttonClicked" and prior to submittal of the page, change it's value to that of the button which the user clicked.
This is more of a JavaScript sol'n, but one that works.

Similar Messages

  • Two buttons on one form

    i have a form that currently has one (image) submit buttong and a check box. If you try to press the button to take you to a new page BEFORE the check box is ticked it brings up an alert.
    I want to add another button that will send the check box information to a phpMyAdmin SQL DB.
    Here is what i have so far
    FORM:
    <form action="eLease.php?userid=<?php echo $row_Recordset1['userid']; ?>" method="post" name="form2" target="_new" id="form2">
          <div align="right"><span id="sprycheckbox2">
            <span class="body-text">Lease Schedule</span><br />
            <input type="submit" name="button" value="confirm" />
            <input type="image" src="../images/smalldownload.png" width="35" height="35" alt="download" value="submit"/>
            </a>
            <input type="checkbox" name="leaseshedule" id="leaseshedule" />
            <br />
          </span></div>
        </form>
    ERROR MESSAGE:
    <div id="ErrorZone1"><span class="checkboxRequiredMsg"><table width="400" border="1" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="400" border="0" cellspacing="10" cellpadding="0">
                <tr>
                  <td><strong>Electronic Signature Agreement:</strong><br /></td>
                  </tr>
                <tr>
                  <td>this is an error message</td>
                  </tr>
                <tr>
                  <td><strong>Terms and Conditions</strong></td>
                  </tr>
                <tr>
                  <td>Terms go Here</td>
                  </tr>
                <tr>
                  <td>I have read and understand the statement above</td>
                  </tr>
                <tr>
                  <td>Signed:<img src="signatures/<?php echo $row_Recordset1['TenSig']; ?>" alt=""/></td>
                  </tr>
                <tr>
                  <td>Guarantor Signature:<img src="signatures/<?php echo $row_Recordset1['GuSig']; ?>" alt=""/></td>
                  </tr>
                </table>
    So i want to add another button that when submitted send the checkbox "y" to the DB then sends them back to this page, they can then click the other button and log into the eLease.php page
    thanks in advance

    Sorry, I don't understand the logic of what you're trying to do.
    As far as I can see, you want to make sure that the user has selected the check box before being able to proceed. The check box name isn't sent with the form data if the check box hasn't been selected when the form is submitted.
    Let's say your check box is called "agree". You can test to see whether it has been checked like this:
    if (!isset($_POST['agree'])) {
        // return the user to the original form with an error message
    } else {
        // process the form
    Message was edited by: David_Powers to clarify what happens if check box isn't selected.

  • Send two button in one form

    hi...
    i'm using jsp to design and coding in netbeans...
    my problem is....i have 2 button first button i'm using to searching and another button is to update but this 2 button send the parameter using form like this....
    <form action="<%=request.getContextPath()%>/tbcForeigner.do" method="post" name="search">
    and my searching function success....but i have problem to pass update button.....
    how to send this update button....

    The end result of all that "I'm using Netbeans to write a JSP" process is that you produce HTML. So forget about JSP and Netbeans for a minute and design the HTML you want to output.
    Can't do that? You don't know how to do whatever it is you were trying to ask? Okay, fine. Then it's an HTML problem and this isn't an HTML forum. Go and find one. Ask the question about your HTML.
    Or have you decided how your HTML should look and you can't write a JSP that produces that HTML? Then it's a JSP problem. Notice that this is a "Java Programming" forum. You don't have a Java Programming problem, you have a JSP problem. Scroll down the list of forums for a bit and you'll see the JSP forum.
    And if you are having a problem getting Netbeans to do something, then you should find a Netbeans forum to ask about that.

  • Can we have two submit buttons in one form

    please someone help me. my problem is i want two submit button in one form.one to insert data and other to search data .how can i do this.

    hi!
    it is possible but impragmatic to supply a single form with 2 submit buttons.
    albeit, rather that use submit button you may just do the following (alternatively):
    a. put a default action url to your form's action attribute;
    b. replace all your submit button with just button (form element) and put a unique id on each;
    c. then put a function name (javascript) on its onClick attribute;
    d. in your javascript function, you may now reference your button through their id's and using an if-then statement, assign the proper url that will serve as the new action for your form;
    e. on the last line of your function, execute the line formname.submit()doods72
    http://www.ingenium.com.ph

  • Two buttons in Adobe Form

    Hello,
    I am using Netweaver 2004s SP10. Does any body know how to incorporate two buttons in a Adobe Interactive Form. I want to insert approve button and reject button with different actions for each button.
    Moreover, How can we remove the toolbar buttons in the adobe form at runtime. since they occupy a major portion of area. How to reomve the print, save, all these buttons.
    Thanks, any help is appreciated.
    Sunita.

    hi Sunita,
    as far as i have seen it...
    we have two types of buttons that are accesible in WebDynpro.
    GOTO interactive form->edit->Library tab->web dynpro tab
    1).Submit to SAP and 2).Check.
    these two buttons and their corresponding events and actions are available in Web Dynpro when the form is available online(ONLINE scenario).
    you can change the text on these buttons to ur requirement like "APPROVE" or "REJECT" in the form editor.
    now these two buttons in the form will just act like buttons in Web Dynpro layout.
    in the properties of the interactive form you can see events for these....
    now you can go to implementation and write as desired code.
    the code for rejecting and approving the form...
    (You must be knowing that the contents of the form are available in the ONLINE scenario in the corresponding CONTEXT attributes of the form for use in dynpro
    ie when online you can modify the contents of the Form by working on dynpro Context attributes like getAttribute(), or setAttribute(). )
    regards,
    -amol gupta

  • Use two actions in one form

    I want to use two actions in one form in struts,and without using javascript,is it possible?

    I want to use two submit:
    one is for adding message;
    another is for editing message.
    they must be in one form,but i dont know how to use
    two actions in one formHi,
    Hope this helps.
    cheers,
    jeric
    <html>
    <head>
    <title>decision</title>
    </head>
    <body>
    <br><br><br>
    <center><h3><u>Two submits, one form</u></h3></center>
    <%
    String userChoice = request.getParameter("decision");
    if( userChoice != null && userChoice.equals("add") == true)
        // forward to addMessage.jsp, for example, or whatever
    else
    if( userChoice != null && userChoice.equals("edit") == true)
         // forward to EditMessage.jsp, for example, or whatever
    out.println( "<br><center> the value of userChoice after selection is ... " + userChoice + "</center><br>");
    %>
    <center>
    <form method="post" action ="decision.jsp"> <!-- name of this page -->
        <table width = "50%" align="center">
             <tr><td width = "100%"><hr color ="red" ></td></tr>
              <tr><td height = "10"></td></tr>
             <tr><td align = "center">Do you want to <b>add</b> a message or <b>edit</b> a message?</td></tr>
             <tr><td height = "10"></td></tr>
             <tr><td align = "center">
                  <input name = "decision" type = "radio"  value = add checked>?add a message??
                  <input name = "decision" type = "radio" value = edit>?edit a message?
             </td></tr>
        </table>
        <br>
        <input type="submit"  value = " make your selection " >
    </form>
    <hr color ="red" width = "50%">
    </center>
    </body>
    </html>

  • Two buttons on one region

    Hello,
    here my problem:
    I have a region(SQL_Report) called "Search". There I have a search-function. On this region I have two Buttons. One calleed Search and one called Reset.
    If I search after a word and click on the Search Button I get a result table -> that works.
    If I click on reset I want the result table to be cleared.
    How can I do this?
    Hope anybody can help me.
    Steffi

    Hi Scott,
    first my Code was like this:
    declare
    q varchar2(4000);
    begin
    q := 'SELECT NAME Name,VERANTWORTLICHER_TEAM Verantwortlicher,BETRIEBSSYSTEM Betriebssystem,WERKZEUG_SPRACHE Sprache FROM PROJEKTE';
    if :P1_SUCHEN is not null then
    if :P1_RADIOBUTTON = 'B' then
    q := q || ' WHERE UPPER(BETRIEBSSYSTEM) LIKE ''%' || UPPER(:P1_SUCHEN) || '%'' ';
    elsif :P1_RADIOBUTTON = 'V' then
    q := q || ' WHERE UPPER(VERANTWORTLICHER_TEAM) LIKE ''%' || UPPER(:P1_SUCHEN)|| '%'' ';
    else q := q || ' WHERE UPPER(WERKZEUG_SPRACHE) LIKE ''%' || UPPER(:P1_SUCHEN)|| '%'' ';
    end if;
    end if;
    return q;
    end;
    Here I search after specific criterias. This works. I click on the radio button "Betriebssystem(operating system)" and write "L" into my textfield. If I press the search button I got a result table with all datas about the project running with the operating system Linux.
    Now I want to press the reset button and want the table to be cleared. But I didn't get it yet.
    Hope you understand what I mean.

  • Two layouts in One form

    Hi,
    I want to create two layouts in one form. how can we create that.
    Thanks in Advance.
    Regards,
    Ramana

    Hi all,
    I have one requirement. I have created a form for Medruck and assigned it in nace tcode for purchase order. My requirement is if version number is ' 0 ' one page should be called and if version number is not zero another page layout should be called. I have created 2 different page layouts in my SAP Script i.e. one page named first layout and second named other layout. if version number is 0 first layout should be called and version number ne 0 other layout page should be called. Is it possible to do it? if so, how shall i do this...
    Kindly help me...
    Thanks and regards,
    subbu.

  • 2 buttons in one form - need help

    I created 2 buttons in one form [xxxx.jsp] .
    Both have same action="xxxx.jsp" <=== I am validating the form in same page.
    If the validations is true and if 1st button is pressed ,then it should go to yyy.jsp page .
    If the validations is true and if 2nd button is pressed , then it should go to zzz.jsp.
    form name=f2 action="main_menu_tech.jsp" method="GET">
    <table align="center">
    <tr>
    <td>
    <h3><font color="#008080"><b>Ticket ID</b></td>
    <td><input type="text" name="t1"></font>
    </h3>
    </td>
    </tr>
    <tr>
    <td>nput type="submit" value="Search" name="button1"></td>
    <td><input type="submit" value="Edit" name="button1"> </td
    </tr>
    </table>
    </form>
    <%@ page import= "java.sql.*;"%>
    <%! String tid; %>
    <%tid=request.getParameter("t1");
    session.setAttribute("ob2",tid);
    if(tid!=null)
    if(tid.equals(""))
    { %>
    <br><br><br>
    <h3 align="center"><font color="#008080"><% out.println("FILL IN ALL ENTRIES");%></h3>
    <%
    else
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:bspipdb");
    Statement st = con.createStatement();
    ResultSet rs=st.executeQuery("Select * from datacollectdb where ticketid='"+tid+"'");
    if(rs.next())
    if(request.getParameter("button1") =="search")
    response.sendRedirect("display_ticket.jsp");
    else if(request.getParameter("button1") =="edit" )
    response.sendRedirect("edit_tdetail.jsp");
    else
    %>
    <h3 align="center">
    <font color="#008080">
    <% out.print("Invalid Ticket Number");%>
    <br>
    <% out.print("Please try again with correct Ticket Number");%>
    </font>
    </h3>
    <%
    %>
    The above code is not working. Any idea?
    Please help me out!

    Read the application server logs. My cents on an IllegalStateException.
    To solve this, properly separate the business and controller logic from the presentation logic. Use a Servlet. Right now you're doing some business and controller logic while the presentation logic already has been run. This is asking for problems.
    Not related to the problem, but you should also separate the data logic as well.

  • Multiple Submit buttons on one form

    I'm developing an application that will have 4 buttons at the bottom of the form to do various things with the form information. One of the buttons will link to a separate web page for confirmation of the action. I tried to set a global variable and place an onclick event for the button which assigns a specific value for that variable. I then placed a <jsp:forward tag in my code that would be included if the global variable was the specific value which the button changes it to. I"m not sure if I'm being clear here. There is the forms page with the 4 buttons. It possesses all of this code. So the global variable is declared at the top. The variable is set if the 'Delete' button is clicked. And further down there is an if statement used to include the <jsp:forward tag when the 'Delete button has been pressed and this form is again being drawn up.
    What I describe doesn't work. The global variable I guess is reset when this form is drawn up a second time after the 'Delete' submit button is pressed. I''m not married to the way that I'm solving this problem at this point so I'll take any suggestions. But basically I want the Web Forms fields to be sent to this delete jsp so that I can confirm the command to delete the indicated record from the database. The three other buttons on this form are 'Add/Update', 'Rename', and 'Cancel'. The Add/Update and Rename buttons should also be submit buttons but they should link back to the same page as they are located on. The cancel button is to return the user to the index page. I have this working using a document.location.href command in the onclick event for that button.
    Brian

    Hi Brain. If I'm following your thoughts, you may want to consider replacing the four sumbit buttons with four radio control buttons and one submit button.
    I would suggest that you set your form action via a radio control button then, thru the form action, pass the form to a Servlet or JSP that contains some logic.
    <!doctype html public "-//w3c//dtd html 3.2 final//en">
    <html>
    <head>
    </head>
    <body>
    <!-- set your action here to go against a Servlet or JSP.  The
         Servlet or the JSP will contain the logic to Delete, Add/Update, Rename or Cancel
         based on the formAction value.
    -->
    <form action='ServletOrJSPNameHere' method='post'>
    <br> <input type='radio' name='formAction' value='Delete'>Delete
    <br> <input type='radio' name='formAction' value='Add/Update'>Add/Update
    <br> <input type='radio' name='formAction' value='Rename'>Rename
    <br> <input type='radio' name='formAction' value='Cancel'>Cancel
    <br> <input type='submit' value='submit'>
    <form>
    </body>
    </html>
    // this code would go into your Servlet, JSP, or worker class
    String formAction = request.getParamger("formAction");
    // test for null value  
    if ( formAction == null ) { 
         // reload the page with a message to pick a radio button
    else if ( formAction.equals("Delete") {
       doTheDeleteProcessing();
    else if ( formAction.equals("Add/Update") { 
       doTheAdd/UpdateProcessing();
    else if ( formAction.equals("Rename") {
       doTheRenameProcessing();
    else {
       doTheCancelProcessing();
    }I hope this helps.

  • Combine two lists in one form (1 to Many relation)

    I have two list instances. I have a custom form on which I would like to show two lists and add more button to let user select to add more child records and save which should save in both the lists. And again when user pull the item from main list it should
    display the child list items as well. Can someone point me good link to achieve this.
    Thanks,
    Alex

    Hi,
    According to your description, my understanding is that you want to display two lists in a form and add item to both lists when clicking a button, also
    you want to display items in child list when searching items from main list.
    If that is the case, there is a possible solution is that you can create a custom web part with two Gridviews bind with the lists data and a button. When
    you click button, you can add list items to both grid in code behind. And, when you search the items from main gridview , you can query the list items value in child list using CAML Query to display the items in child list.
    Here are some detailed code demos for your reference:
    Create a custom web part:
    http://msdn.microsoft.com/en-us/library/ee231519.aspx
    Add or update list items using C#:
    http://msdn.microsoft.com/en-us/library/office/ee539976(v=office.14).aspx
    Query list item using CAML Query:
    http://msdn.microsoft.com/en-us/library/office/ee534956(v=office.14).aspx
    Bind SharePoint list data to GridView:
    http://sharepoint.kerenapura.com/2013/09/display-sharepoint-list-data-gridview/
    Best regards
    Zhengyu Guo
    TechNet Community Support

  • How to work with two blocks in one form

    i need help,i moved the control from block(abc) to another block(xyz) using go_block('xyz') and then i insert record to block(abc) but the record is not inserted to the table .
    i used previous_block but it is not working
    how to use it.

    Hi,
    You have written the code in when-window-activated? If yes then as soon as the window of xyz is activated the code starts running and populating the data (i.e. department code and its name) from table to the block, one by one. It seems that the block 'xyz' is like detail block. Am I right? U want the record row by row, isn't it?
    In this case, have you been able to populate your xyz block more than 1 records by the help of the code you have written ? If yes then use commit_form in the when-button-pressed trigger associated with the proposed button.
    I just can't understand how your code populates xyz block when you are writing :
    fetch DEPARTMENT into :DEPARTMENTS.DEP_CODE,:DEPARTMENTS.DEP_NAME;
    instead of fetch DEPARTMENT into :xyz.DEP_CODE,:xyz.DEP_NAME;
    Pls tell me the detail result you r getting.
    Regards,
    Pragati.

  • How to handle more than one button in a form?

    Hello Java fans,
    I am new to Servlets. I am facing a problem in java servlet. I tried to place two buttons in the form. Both buttons has to invoke different servlets. How to associate action to each button?
    Thanks in advance,
    SMVEL

    Give each button a different name so that you can check which button is clicked.
    <input type="submit" name="button1" value="Press this button to invoke servlet1">
    <input type="submit" name="button2" value="Press this button to invoke servlet2">
    Then in your controller servlet:
    if(request.getParameter("button1") != null){
    //button1 is pressed.
    //forward to servlet1.
    else if(request.getParameter("button2") != null){
    //button2 is pressed.
    //forward to servlet2.
    }

  • Two Buttons on the Interactive Form

    Hi Gurus,
              I need to have two buttons on the form which perform different actions So I  need to identify the button clicked in the OnSubmit event.
                I  have two buttons on the form "Submit" and "BACK". So I added the two submit buttons on the form, both are working as OnSubmit event is getting triggered by both the buttons.
    From some previous posts, I read that I've to add a attribute to context and set the attribute value in the form when the button is clicked. So added a field binding that to context attribute.But , When I write below code , the submit button does not work.
    xfa.form.Page1.Subform.Buttonclicked.rawValue = "BACK";
    Where Page1 is page , Subform is subform Buttonclicked is my attribute in context/field on the form for attribute
    I  tried adding this code before and after the submit events code that is,
    ContainerFoundation_JS.SendMessageToContainer(event.target, "submit", "", "", "", "");
    Am I adding the code in correct place? Is the code correct to set the attribute/field value?
    Can anybody help me resolving this issue?
    Thanks in advance!
    Regards,
    Kuldeep Jadhav

    This issue has been discussed here before. Please go through my replies here --> Dropdown List Scripting to display another Drop down List.
    Chintan

  • Close more than one forms by one close button

    Respected All......
    can this possibility in forms6i that i close more than one forms by close button on one form including that form.
    Regards
    Edited by: user514721 on Feb 18, 2009 2:31 AM

    You could set a global to a specific value , e.g. :GLOBAL.EXIT_ALL:='TRUE'; at the moment you want to end all forms. The rest dependson the way you called the other forms. If you use CALL_FORM, you would chekc the global immediately after teh call_form
    CALL_FORM('X');
    IF :GLOBAL.EXIT_ALL='TRUE' THEN
      EXIT_FORM;
    END IF;If you use OPEN_FORM you would have to do the same in the WHEN-FORM-NAVIGATE-trigger.

Maybe you are looking for

  • IMac G5 - No picture or video on start

    Hi, I have an iMac G5 with Ambient Light systema and no iSight. The probleme is that when I press the POWER button, I hear start up sound and also the fan but nothing is displayed on the screen. So via Apple Support webpage, I have done some troubles

  • Not a valid SOAP Content-Type: text/html; charset=iso-8859-1

    Friends JDEV and SOA suite 10134 I have multiple domains on my BPEL Server. In one of the domain since I deployed the new process, all the processes of that domain are now failing on execution with following error in opmn/soa_instance/*.err log files

  • Whatsapp on Nokia E7

    I am using nokia E7 and when I am using Whatsapp messenger it is working only on Network Data and not on Wifi... When I am at home wifi is connected. All other applications like nimbuzz is working on wifi but whatsapp need network data. Can any1 help

  • Joining shapes

    when joining together two different shapes, such as the ones in the picture: 1. Do the anchor points have to touch at their ends? Can there be any overlap of the anchor point or paths? I tried both ways and it seemed to join. Though I just want to be

  • CProject Suite and WebDAV ...

    Hi all ! created eternal alias in 'sicf' for <defaul_host/sap/cpro> named webdav; now i want to connect to this WebDAV folder via Portal Drive or open this URL as a webfolder in Internet Explorer ... for example http://<fqdn>.<port>/webdav/dpr for cP