?
Solved

Multiple SUBMIT buttons that are images

Posted on 2003-12-04
5
Medium Priority
?
474 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

762 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