?
Solved

Multiple SUBMIT buttons that are images

Posted on 2003-12-04
5
Medium Priority
?
484 Views
Last Modified: 2012-05-04
OK, I have 4 submit buttons that are:

<input type="image" src="../img/updatedisplay.gif" name="submitbutton" value="Update Display" >
<input type="image" src="../img/updateavail.gif" name="submitbutton" value="Update Availability" >
<input type="image" src="../img/updatejobname.gif" name="submitbutton" value="Update JobName" >
<input type="image" src="../img/updatejobdescription.gif" name="submitbutton" value="Update JobDescription">

Obviously they are under their specific form fields.  

The form posts to itself via:  <form name="editjob" action="editjob.asp" method="post">

At the very top of the page I have the following ASP code to find out which submit button was pressed:

Call GetConnection ()
Call GetRecordSet(objRS)
Call GetCommandObject(objCommand)

      If request("submitbutton") = "Update Display" then
            objCommand.CommandText = "Update tblJobs SET newofficeDisplay = '"& request("display") & "' WHERE JobID = " & request("JobID") &" "
            Set objRS = objCommand.Execute
      elseif request("submitbutton") = "Update Availability" then
            objCommand.CommandText = "Update tblJobs SET applicationLive = '"& request("applicationLive") & "' WHERE JobID = " & request("JobID") &" "
            Set objRS = objCommand.Execute
      elseif request("submitbutton") = "Update JobName" then
            objCommand.CommandText = "Update tblJobs SET JobName = '"& request("JobName") & "' WHERE JobID = " & request("JobID") &" "
            Set objRS = objCommand.Execute
      elseif request("submitbutton") = "Update JobDescription" then
            Dim myControl1, myFieldContents
            Set myControl1 = GetObject ("script:" & Server.MapPath ("/RichEdit/ASPRichEdit.WSC"))
            myControl1.Name = "JobDescription"
            myFieldContents = myControl1.GetSafeFieldContents
            objCommand.CommandText = "Update tblJobs SET jobdescription = '"& myFieldContents & "' WHERE JobID = " & request("JobID") &" "
            Set objRS = objCommand.Execute
      end if


Now, this work before when it was just a plain SUBMIT form button.  Now that I have added the image for the button it doesn't work.  Any ideas?

Thanks!
Dark Magneto
0
Comment
Question by:darkmagneto
[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
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 2000 total points
ID: 9875958
try something like this

<form name="editjob" action="editjob.asp" method="post">

<input type="image" src="../img/updatedisplay.gif" name="submitbutton" value="Update Display" onclick='document.editjob.dummy.value="Update Display"'>
<input type="image" src="../img/updateavail.gif" name="submitbutton" value="Update Availability" onclick='document.editjob.dummy.value="Update Availability"'>
<input type="image" src="../img/updatejobname.gif" name="submitbutton" value="Update JobName" onclick='document.editjob.dummy.value="Update JobName"'>
<input type="image" src="../img/updatejobdescription.gif" name="submitbutton" value="Update JobDescription" onclick='document.editjob.dummy.value="Update JobDescription"'>

<input type="hidden" name="dummy">

</form>



then for your editjob.asp, change to this

If request("dummy") = "Update Display" then
         objCommand.CommandText = "Update tblJobs SET newofficeDisplay = '"& request("display") & "' WHERE JobID = " & request("JobID") &" "
         Set objRS = objCommand.Execute
    elseif request("dummy") = "Update Availability" then
         objCommand.CommandText = "Update tblJobs SET applicationLive = '"& request("applicationLive") & "' WHERE JobID = " & request("JobID") &" "
         Set objRS = objCommand.Execute
    elseif request("dummy") = "Update JobName" then
         objCommand.CommandText = "Update tblJobs SET JobName = '"& request("JobName") & "' WHERE JobID = " & request("JobID") &" "
         Set objRS = objCommand.Execute
    elseif request("dummy") = "Update JobDescription" then
         Dim myControl1, myFieldContents
         Set myControl1 = GetObject ("script:" & Server.MapPath ("/RichEdit/ASPRichEdit.WSC"))
         myControl1.Name = "JobDescription"
         myFieldContents = myControl1.GetSafeFieldContents
         objCommand.CommandText = "Update tblJobs SET jobdescription = '"& myFieldContents & "' WHERE JobID = " & request("JobID") &" "
         Set objRS = objCommand.Execute
    end if




hongjun
0
 
LVL 35

Expert Comment

by:YZlat
ID: 9875976
try

<input type="image" src="../img/updatedisplay.gif" name="submitbutton" value="Update Display" onClick="document.editjob.submit()">

<input type="image" src="../img/updateavail.gif" name="submitbutton" value="Update Availability" onClick="document.editjob.submit()">
<input type="image" src="../img/updatejobname.gif" name="submitbutton" value="Update JobName" onClick="document.editjob.submit()">

<input type="image" src="../img/updatejobdescription.gif" name="submitbutton" value="Update JobDescription" onClick="document.editjob.submit()">

0
 

Author Comment

by:darkmagneto
ID: 9876006
Submit is not the problem...it is passing the value that is the issue.

It is not passing ANY value at all.

darkmagneto
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9876037
try my method of using a hidden field
0
 

Author Comment

by:darkmagneto
ID: 9876092
It worked!

Thanks!

darkmagneto
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

650 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