Solved

Multiple SUBMIT buttons that are images

Posted on 2003-12-04
5
457 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
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 500 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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