Solved

Multiple SUBMIT buttons that are images

Posted on 2003-12-04
5
409 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
try my method of using a hidden field
0
 

Author Comment

by:darkmagneto
Comment Utility
It worked!

Thanks!

darkmagneto
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 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 information …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now