|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
Try using: if ( check != "null" ).
|
|
#3
|
|||
|
|||
|
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.... |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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" ) |
|
#6
|
|||
|
|||
|
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.... |
|
#7
|
|||
|
|||
|
anyway, i manage to solve the problem...
thanks... |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > check submit button |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|