Three buttons in a form

Hi,
I have three buttons in a form. Each button passes control to a different servlet when clicked. The problem is it is not passing any parameters when button is clicked. When i used the buttons individually everything works fine, the parameters are received correctly. Could anyone tell me what the problem might be.
             import javax.servlet.*;
             import javax.servlet.http.*;
             import java.io.*;import java.sql.*;
             public class CCCtable extends HttpServlet{
             public void init(ServletConfig config) throws  ServletException   {
                   super.init(config);
                   try{        Class.forName("oracle.jdbc.driver.OracleDriver"); 
                catch (ClassNotFoundException e)
                    System.out.println("Couldn't load Oracle driver");
                      throw new UnavailableException(this, "Couldn't load Oracledriver");  
                catch (Exception e)      {         e.printStackTrace();      }
       public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,                                                                                     IOException
           doPost(req, res);
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws                                        ServletException, IOException
            ServletContext cont = getServletContext();
           int i = 0, j = 0;  
           String[] row_id = new String[100];
          HttpSession hs = request.getSession(true);
         hs.putValue("theKey", row_id); 
        response.setContentType("Text/html");
         PrintWriter out = response.getWriter(); 
         out.println("<HTML>");
          out.println("<HEAD><TITLE>Holiday Table</TITLE></HEAD>");
     out.println("<BODY BGCOLOR=\"#FFFFFF\">");
     out.println("<CENTER>");
      out.println("<BR><BR>");
      Connection conn = null;   
      try
         conn = DriverManager.getConnection( "jdbc racle:thin:@asd:1521:asd","qwer",                                                                               "qwer");
         Statement stmt = conn.createStatement();
          ResultSet rs = stmt.executeQuery("Select a.*, rowid from holiday a");
          out.println("<TABLE><TR>");
           out.println("<Form method=\"post\"><TH>");
           out.println("<INPUT type=\"button\" name=\"add\" value=\"Add\"                                onClick=\"sendToServlet(1)\"> ");                  
            out.println("<INPUT type=\"button\" name=\"delete\" value=\"Delete\"                                onClick=\"sendToServlet(2)\"> ");
            out.println("<INPUT type=\"button\" name=\"update\" value=\"Update\"                              onClick=\"sendToServlet(3)\"> ");
            out.println("</TR></TABLE>");
           //Print start of table and column headers
            out.println("<TABLE CELLSAPCING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");        
                   out.println("<TR><TH>SELECT</TH><TH>HOLIDAY_CODE</TH><TH>HOLIDAY_DESCR</TH>");
             out.println("<TH>HOLIDAY_DATE</TH><TH>LAST_CHANGE_USERID</TH>");
             out.println("<TH>LAST_CHANGE_TMSTMP</TH></TR>");
                      //Loop through results of the query
                      while(rs.next())
                         out.println("<TR>");
                         out.println("<TD align=center><input type=checkbox name=icheck["+(i++)+"] value="+i+"></TD>");
                         out.println("<TD align=center>" + rs.getString("HOLIDAY_CODE") + "</TD>");
                         out.println("<TD align=center>" + rs.getString("HOLIDAY_DESCR") + "</TD>");
                         out.println("<TD align=center>" + rs.getString("HOLIDAY_DATE") + "</TD>");
                         out.println("<TD align=center>" + rs.getString("LAST_CHANGE_USERID") + "</TD>");
                         out.println("<TD align=center>" + rs.getString("LAST_CHANGE_TMSTMP") + "</TD>");
                         out.println("</TR>");
                         row_id[j] = rs.getString("rowid");
                         j++;
                      out.println("<input type=hidden name=abcd value="+i+">");
                      out.println("</FORM>");
                      out.println("<script language=\"JavaScript\">");
                      out.println("function sendToServlet(buttonPressed){");
                      out.println("if (buttonPressed == 1) {");
                      out.println("window.location = \"/servlet/add.class\";");
                      out.println("}else if (buttonPressed == 2)");
                      out.println("{window.location = \"/servlet/delete.class\";");
                      out.println("}else if (buttonPressed == 3)");
                      out.println("{window.location = \"/servlet/update.class\";");
                      out.println(" }}");                  
                      out.println("</script>");
                      out.println("</TABLE>");
                   catch(SQLException e)
                      out.println("SQLException: " + e.getMessage() + "<BR>");
                      while((e = e.getNextException()) != null)
                         out.println(e.getMessage() + "<BR>");
                   finally
                      //Clean up resources, close the connection
                      if(conn != null)
                         try
                            conn.close();
                         catch (Exception ignored) { }
                   out.println("</CENTER>");
                   out.println("</BODY>");
                   out.println("</HTML>");

I can't understand how its possible for it to work with one button if your doing it in the same way, because you are not submitting your form, you are simply going to a new url. Its like typeing it into the address bar.
try these things to fix it
1. Name your form
<Form method="post" name="myform">
2. Instead of doing
window.location = "url";
do
document.myform.submit();
3. In your if/else decision change the action value of the form to the appropreate value.
So, your javascript method should look something like this.
function sendToServlet(buttonPressed)
  if(buttonPressed == 1)
    document.myform.action = "/servlet/add.class";
  else
  if(buttonPressed == 2)
    document.myform.action = "/servlet/delete.class";
  else
  if(buttonPressed == 3)
    document.myform.action = "/servlet/update.class";
  document.myform.submit();
}BTW, the approach from neville would be alot easier to implement on both client and server side, thats the way I'd do it. :-)
Hope this helps
Regards
Omer

Similar Messages

  • 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.

  • Item ID for Minimize, Maximize button at system form title bar

    Hi,
    Can anyone help me out finding Item ID for Minimize, Maximize and close buttons at system form title bar (Left side Title of form and right side three buttons). I need ID for these items, if anyone knows please reply. will appreciate help on same.
    Thanks,
    Jay

    I'm tryin to get over with Item master screen strech machenism. I've Added matrix at pane 6 and position is not fixed when ever form is rezised or base product font size is changed. I've alredy tried providing values to top left width height through oexisting item vaues, I'm not using any integer value. Let me know if i can freez it's position ....... Sample code below
    oExistingItem = oForm.Items.Item("174")
    oItem = oForm.Items.Add("mtx_MFGALS", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
    oItem.Top = oExistingItem.Top + oExistingItem.Height + oExistingItem.Height
    oItem.Width = oExistingItem.Width + oExistingItem.Width
    oItem.Height = oExistingItem.Width
    oItem.Left = oExistingItem.Left
    oItem.FromPane = "6"
    oItem.ToPane = "6"
    oMatrix = oItem.Specific
    oMatrix.Columns.Add("Col0", SAPbouiCOM.BoFormItemTypes.it_EDIT)
    oMatrix.Columns.Item("Col0").TitleObject.Caption = "Line #"
    oMatrix.Columns.Add("Col1", SAPbouiCOM.BoFormItemTypes.it_EDIT)
    oMatrix.Columns.Item("Col1").TitleObject.Caption = "Name"
    oMatrix.AutoResizeColumns()
    Regards,
    Jay

  • Modifying the appearance of the search box, the search button, and the submit button for web forms

    I'm trying to modify the appearance of the search box, the search button, and the submit button for web forms by modifying the CSS on Stylesheets. None of the tags I'm using (e.g. .webform .cat_button) seem to be working. What are the correct tags for those three elements?

    When you generate the help you can select / deselect the buttons that are displayed.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Creation of UI elements on click of a button in ADOBE form

    Hello Experts,
    I have a requirement which is ,
    on the ADOBE form after pressing some action Button i need to create a row of UI elements like Textbox label and Radio button with the values coming from Backend WDA application.
    Number of rows created are equivalent to number of  times button is clicked.
    Also in some cases i have to preload the rows with the existing data.
    Please let me know if this requirement can be accomplished in ADOBE form.
    Any inputs ,Suggestion and help will be very helpful.
    Thanks,
    Siddharth

    Thanks for the help,
    I resolved this by creating elemnts in WD context on click of a button in ADOBE form,And in form i used the WD context structure as a table with required cell editors.
    PDF form should be of type dynamic in this case.

  • Button Text on Form not Displaying

    The following was posted by PGMR1998 at 09:58am on Feb 22, 2008 (Pacific) but got no response:
    I am using Adobe Acrobat Pro 8, and I have added a button to reset the form fields. The button has some text on top, but the text on the button does not display until I click down on the button in the preview pane. How can I make the button text visible always? Thanks in advance for your support..
    I'm having the same problem with the submit button on a form in Acrobat 9 Pro Extended. No matter what I do, the button text does not display. Any ideas?

    What font are you using? What is the font color set to? What font size? Can you post a sample somewhere?
    You specify the label text for a button using the Options tab of the Button Properties dialog. Describe each of the settings on this page. In particular, you can have a different label for the Up, Down, and Rollover states.
    George

  • How do I create a submit button for my form? I would like it to send the completed PDF to an email address

    Hi everyone,
    I recently upgraded to Adobe XI and I can't find a "submit by email" button for my form. I created a button and tried to set up some actions but, I can only get the button to direct the user to a URL. How do I make it send the completed PDF to our designated company email address? I'm not too familiar with JAVASCRIPTS so I haven't tried that plus I heard it may not work with users with adobe reader.
    Any help would be appreciated.
    Thanks,
    Matt

    Thanks for the input. I think you might have a different version of LiveCycle than the copy I have since it looks a little different. However, I found the answer in Adobe help. I had to type "mailto:" before the email address to indicate it's an email and not a URL. See below.
    To collect form data as attachments to email, type mailto: followed by the email address. For example, mailto:[email protected]

  • Oracle Apps Sys Admin -- Disabling a button on a form

    Hi Guys,
    I want to disable a button on a form in oracle applications. Normally, i disable a button by goin to that MENU, SUBMENU(if there are any) and take the button's sub-function and add it in FUNCTION and MENU Exclusions in the reponsibility define form.
    But in some forms in Oracle Inventory, i have a NEW button and am not able to find a sub-function for that. NEW and OPEN , two buttons are there . How can i disable or make that button vanish from that form. I know that it can be done thru CUSTOM.pll but without custom.pll , is there a way using this sub-functions or watever.
    help appreciated.
    Thanks

    Yes I know about form personalization, however I still couldn't hide 2 buttons. Open vision database, under purchasing superuser > requisition summary, if you click the Find button it will open Requisition Header Summary window. In that window there are New and Open button. Now, I couldn't hide those 2 buttons cause I couldn't found the name in Item. What's the name of those 2 buttons? Thanks.

  • Trying to makea report run when clicking a button on a form

    I am trying to run a report by clicking a button on a form (Forms 9i)
    I have modified the registry settings for FORMS90_PATH and REPORTS_PATH to include my development directory, and now at last the report is generating. However the command to display the form in a window is not doing anything at all - no error even. Can someone please help, the trigger code for my button is displayed below:
    DECLARE
         rep_result VARCHAR2(30);
    BEGIN
         SET_REPORT_OBJECT_PROPERTY('INVENTORY_REPORT', REPORT_FILENAME, :GLOBAL.project_path || 'Inventory.rdf');
         SET_REPORT_OBJECT_PROPERTY('INVENTORY_REPORT', REPORT_DESNAME, :GLOBAL.project_path || 'Inventory.htm');
         rep_result := RUN_REPORT_OBJECT('INVENTORY_REPORT');
         --MESSAGE('Rep result: ' || rep_result);
         WEB.SHOW_DOCUMENT('file:///' || :GLOBAL.project_path || 'Inventory.htm', '_blank');
         --WEB.SHOW_DOCUMENT('file:///C:\Temp\Dev\Inventory.htm', '_blank');
    END;
    thx
    adam

    Hi,
    may be this could be helpful for you:
    You have to include the following code to execute a report:
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status Varchar2(20);
    BEGIN
    repid := find_report_object(report_name);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,report_server_name);
    v_rep := RUN_REPORT_OBJECT(repid);
    rep_status := report_object_status(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    if rep_status = 'FINISHED' then
    WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
    else
    error report not exists
    end if;
    END;
    Also you have to create the report server with the command:
    "rwserver - install service_name autostart=yes
    report server name must be the same that appears in the code above
    You must add the report to run in the REPORT object type in your .fmb and put there with the same name
    The report server to install ought to be the one and only in you network to avoid mistakes...

  • Making a "Save As" button on a form

    I need to make a "Save As" button on a form created in Designer 8.0.
    This will go on a form that will be enabled for Reader 8.0, so user can fill in form, save filled form, and submit via e-mail.
    I have tried to figure how to add a regular Button, and add a simple menu functionality like "Save As" but cannot.
    I need step-by-step instructions for this, please... and I do not know much about scripting at all.
    TIA,
    Glenn Cauley

    Have a look in the Help (index Script Editor => about). This should give you more insight into how the Script Editor is used.
    For this example, you'd just need to select your button, make sure the 'click' event is in the 'Show' drop-down, select 'JavaScript' from the 'Language' drop-down and then paste the script into the script editing field.
    Thanks,
    Mike
    Adobe Systems

  • Very Urgent! Print Report output to local printer on button click in form

    In Sales Order Form there is a print receipt button. In current situation On Clicking the 'Print Receipt Button' it submits a XML Publisher report(PDF output) to the concurrent manager. Currently to print that report i need to go view--> requests--> view output and then print. According to my new Requirement i need to print that report directly to local printer on one simple Print receipt button click in form.
    I am trying to call the printers on server using custom.pll. The report is running successfully but it is not printing output to the local printer. I need to print the report to the local printers based on responsibility. Local printers are available on apps server. Can anyone help me on this issue ASAP.
    Is it possible to print the document using custom.pll? Is there any other alternative to print the report on simple button click in form.
    Environment: Apps 11.5.10.2, Forms 6i
    Here is the code that i am using in my custom.pll.
    if (v_form_name = 'OEXOETEL' --and v_block_name = 'LINES_SUMMARY'
         and name_in('parameter.ACTIONS') = 'PAYMENT_RECEIPT' )THEN
    l_organization_id := Name_In('PARAMETER.OE_ORGANIZATION_ID');
    l_order_header_id := Name_In('ORDER.header_id');
    select to_number(oe_sys_parameters.value ('SET_OF_BOOKS_ID')) into l_sob_id from dual;
    xml_layout := FND_REQUEST.ADD_LAYOUT('XXAFP','XXAFPOEXPMTRCRTF','en','US','PDF');
    select a.profile_option_value
    into v_printer_name     
    from fnd_profile_option_values a
    , fnd_profile_options b
    , fnd_profile_options_tl c
    , fnd_user fu
    where a.profile_option_id = b.profile_option_id
    and c.profile_option_name = b.profile_option_name
    and fu.user_id (+) = a.level_value
    and c.language = 'US'
    and c.user_profile_option_name='Printer'
    and a.level_id = 10003 ;
    if (FND_SUBMIT.SET_PRINT_OPTIONS(v_printer_name, 'Portrait', 2, TRUE, 'N'))
         then
    l_new_request_id := FND_REQUEST.SUBMIT_REQUEST('XXAFP','XXAFPOEXPMTRC',
    null,null,FALSE,l_sob_id,l_organization_id,NULL,NULL,l_order_header_id,
    chr(0), '', '', '', '', '', '', '', '', '', '',
    end if;
    fnd_message.set_string('Request Submitted for Custom Payment Receipt. Request ID is '||l_new_request_id);
    fnd_message.show;
    copy('NULL','parameter.ACTIONS');
    IF (l_new_request_id = 0) THEN
    FND_MESSAGE.RETRIEVE;
    FND_MESSAGE.ERROR;
    else
    l_commit_result := APP_FORM.QuietCommit;
    END IF;
    I need to complete this requirement immediately. Can anyone suggest me better ways in doing this.
    Thanks,
    Srinivas

    I solved this problem myself using shell script through custom.pll. I wrote shellscript and called that shellscript through FND_REQUEST.SUBMIT_REQUEST.It printed 2 copies to local printer.

  • How do I change the destination of a the submit button on a form in Form Central?

    How do I change the destination of a the submit button on a form in Form Central?

    Sure. Because it is a scheduling form and I want the filled out form to be forwarded to our scheduling department email.
    Sincerely,
    John Biester
    Operations Manager

  • How do i add a submit button to a form

    ho do i add a submit button to a form.

    Hi;
    If you are using the FormsCenral website to create a form it will have a submit button by default for the HTML (web) form and also by default it you are saving as PDF (there is an option to create a PDF without Submit, but by default it does submit to FormsCentral). 
    If you are using the FormsCentral desktop application that is bundled with Acrobat XI you would have to sign into the service to create forms with Submit buttons.  You can also create a form without submit button in FormsCentral Desktop and then edit the form in Acrobat XI adding a submit button using your preferred submit method such as by email.
    Let me know if you need more information on either of these, it will be easier to assist knowing more about what you are using.
    Thanks,
    Josh
    PS - if this is a question about adding a submit button in Acrobat not related to FormsCentral your question would be best asked in http://forums.adobe.com/community/acrobat

  • How to hide 'SAVE' button in adobe form layout

    Hi  Friends,
    I have a requirement to hide 'SAVE' button in adobe form layout .They dont want to save the form .
    Is there any way to achieve this .I have gone through scn ,but couldnt find the proper solution
    Thanks and Regards,
    Subeesh Kannottil

    Hi Subeesh,
    Are you talking about restricting the User from Saving the Adobe Form Output. 
    Regards,
    Sivanand Ala

  • How to disable delete button in a form

    HI
    can anyone show me the procedure to disable the delete button from oracle forms seeded and custom form oracle applications 11i. We are on form patch set level 18
    Regards

    Hi ,
    there are various ways of doing it..
    You can try as the previous post says or also you can try When new block instance trigger and disable the item
    using set_item_property , it all depends on when and how you want to diable that item.

Maybe you are looking for

  • Unable to release Transport request in CHARM

    Hi all,       After Setting up CHARM,created a Transport request,while releasing it thru CHARM gives error:"Release of system Q11 Could not be determined" rgds, rajesh Message was edited by: rajesh         Rajesh M

  • ITunes not writing tag info to file

    Recently iTunes hasn't been writing the tag info to the mp3 files when I import a new cd. I've never had a problem with this until recently. I'm using iTunes 6.0.5 on a Intel Mini 1.66 with OS 10.4.6. When I insert a new disc it shows the proper trac

  • How to add Colums at runtime?

    Hello All, Please tell me how to create Colums in a table at Runtime. And how the Attributes in Columns are created like I want to add Name, age, DOB etc. So that they can be created as Column Name at Runtime. Thanks

  • Problem downloading ML in a MacBook

    Hi: I've tryed at least three times to download ML with my MacBook Air (2011) and all the times did not succeed. I've downloaded ML with my iMac with no problem, but the instalation module I've downloaded simply disapeared after installation, so I co

  • Webmaster tools change of address 301 redirect failed using domain forward

    I'm having trouble with webmaster tools recognising our domain name change. We've recently updated website and done a name change from www.qldtshirt.com.au to www.qtco.com.au. I am using domain forwarding so qldtshirt.com.au forwards to qtco.com.au (