#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0

    check submit button


    if you have two submit buttons, how do u check which button the user clicks on and after that do a query.

    the current codes i have now is:

    String check = request.getParameter("Save as Rejected"); -----(buttons)
    String check2 = request.getParameter("Reset Status"); -----(buttons)


    Queries...

    if(check)
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Rejected\" where SRNo='" + changesrno + "' ");
    }
    else if(check2)
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Pending\" where SRNo='" + changesrno + "' ");
    }
    else{}



    Pls help.....
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Try using: if ( check != "null" ).
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0
    i tried your method. Now there is no error in the program, however, i am still unable to update the database. What do i do???

    if (check != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Rejected\" where SRNo='" + changesrno + "' ");
    }
    else if (check2 != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Pending\" where SRNo='" + changesrno + "' ");
    }
    else{}

    it doesn"t do the else if statement...

    pls help....
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0
    I also tried this method:


    if (check != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Rejected\" where SRNo='" + changesrno + "' ");
    }

    if (check2 != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Pending\" where SRNo='" + changesrno + "' ");
    }


    it check both the if statement and finally use the query and update the status to Pending.
  8. #5
  9. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Oh, heh, you're trying to get parameters that don't exist. You want the name of your submit buttons, not the value. Make sure they all have different names, too.

    <input type="submit" name="save" value="Save as Rejected"/>

    <input type="submit" name="reset" value="Reset Status"/>

    You'd do request.getParameter( "save" ) and request.getParamter( "reset" )
  10. #6
  11. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0
    i make the changes accordingly, however, i am still unable to update the status.
    logically, if the user clicks on save as rejected button, it should update the status to rejected.
    Likewise, if the user clicks on reset status, it should update the status to pending.

    The statement i have is :

    if (check != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Rejected\" where SRNo='" + changesrno + "' ");
    }
    else {}

    if (check2 != "null")
    {
    rs = statement.executeQuery("UPDATE SR_MsgSvc_Creation SET SRStatus = \"Pending\" where SRNo='" + changesrno + "' ");
    }
    else {}

    *note: check is checking to see if user clicks the save as rejected button and check2 is checking to see if user clicks the reset status button.

    i am only able to update if the user clicks on reset status button but not save as rejected button...

    Pls help....
  12. #7
  13. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    19
    Rep Power
    0
    anyway, i manage to solve the problem...
    thanks...

IMN logo majestic logo threadwatch logo seochat tools logo