Solved

Multiple SUBMIT buttons that are images

Posted on 2003-12-04
5
425 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Want the count number from this QUery 2 38
Choose the older file FSO 6 41
Query not working correctly? (or how i want it to... 6 49
IP API - need data... 4 12
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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

15 Experts available now in Live!

Get 1:1 Help Now