ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 4th, 2004, 10:11 AM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Javascript Help with a form using Coldfusion

I have a form in coldfusion that uses two javascript functions depending on what button the user clicks. Here is the form:

<form action ="digitalSignForm.cfm" method="post" name="approveDenyForm">
<input type="hidden" name="materialId" value="">
<input type="hidden" name="approveDeny" value="">
<input type="hidden" name="facilityMessage" value="">
<input type="hidden" name="forwardTo" value="msdsFacilityApproval_action.cfm">
<table width="85%" border="1" cellpadding="3" cellspacing="0">
<tr>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">Material</span></div></td>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">Mfg</span></div></td>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">Issue Date</span></div></td>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">Shelf Life</span></div></td>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">First Aid</span></div></td>
<td width="16%"><div align="center" class="style18 style19"><span style="font-weight: bold">Approve</span></div></td>
</tr>
<cfoutput query="pendingMSDS">
<tr>
<td><span class="style7">#pendingMSDS.Material#
<cfif #pendingMSDS.DocLink# gt "//filer/report_library" >
<a href="#pendingMSDS.DocLink#" target="#pendingMSDS.MaterialId#">View MSDS</a>
</cfif>
</span></td>
<td><span class="style7">#pendingMSDS.Mfg#</span></td>
<td><span class="style7">#dateformat(pendingMSDS.IssueDate,'mm/dd/yyyy')#</span></td>
<td><span class="style7">#pendingMSDS.ShelfLife#</span></td>
<td><span class="style7">#pendingMSDS.FirstAid#</span></td>
<td><span class="style7"><input type="button" name="approve" value="Approve" onclick="approveSubmit(#pendingMSDS.materialId#, '#pendingMSDS.material#');"><input type="button" name="deny" value="Deny" onclick="denySubmit(#pendingMSDS.materialId#, '#pendingMSDS.material#');"></span></td>
</tr>
</cfoutput>
</table>
</form>

Here are the two javascript functions:

<SCRIPT LANGUAGE = "JavaScript">
function approveSubmit(materialId, materialName){
document.approveDenyForm.materialId.value=materialId;
document.approveDenyForm.approveDeny.value=1;
document.approveDenyForm.facilityMessage.value='Please reconfirm the approving of MSDS ' + materialName;
document.approveDenyForm.submit();
}

function denySubmit(materialId, materialName){
document.approveDenyForm.materialId.value=materialId;
document.approveDenyForm.approveDeny.value=0;
document.approveDenyForm.facilityMessage.value='Please reconfirm the denying of MSDS ' + materialName;
document.approveDenyForm.submit();
}
</SCRIPT>

What I want to do is, if the user clicks the 'Deny' button, I want it to first go to an intermediate page and then from there continue on with the normal form procedure. I have no idea how to do this as I am not too familiar with javascript. Any help would be greatly appreciated.

Reply With Quote
  #2  
Old August 4th, 2004, 10:13 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
My knowledge of Javascript is fairly limited as well, so I won't be able to help on this one. If you don't get much response you probably want to post this in the Javascript forum.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old August 4th, 2004, 10:15 AM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yea I actually posted it at both places. Figured it wouldnt hurt. Thanks anyways.

Reply With Quote
  #4  
Old August 4th, 2004, 10:20 AM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,163 Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 21605 Folding Title: Starter FolderFolding Points: 21605 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 3 h 29 m 3 sec
Reputation Power: 684
Not quite sure what you are trying to do.

Do you want it so that if someone hits one of the two buttons, it will go to a process page, and then after processing, come back to the original and continue processing what was left?

Reply With Quote
  #5  
Old August 4th, 2004, 12:25 PM
Jazzjit Jazzjit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Lombard, IL
Posts: 28 Jazzjit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How the form works right now, is that if u click one of the buttons, it goes to a sign page where the user digitally signs off on it and then forwards it to an action page. However, what I want to do is for one of the buttons, when a user clicks it, i want it to go first to a intermediate page where it does some action and what not and then goes to the sign page which will get forwarded to the action page.

Reply With Quote
  #6  
Old August 5th, 2004, 08:39 AM
Ebot's Avatar
Ebot Ebot is offline
Meatball Surgeon
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Elbow deep in code
Posts: 1,163 Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)Ebot User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 21605 Folding Title: Starter FolderFolding Points: 21605 Folding Title: Starter Folder
Time spent in forums: 1 Week 4 Days 3 h 29 m 3 sec
Reputation Power: 684
Well if you don't want to use seperate forms for each button, you can use javascript to fire off the to the next page. you can use location.replace("index.cfm"). However, this is not a submit, it is a redirect, so there will be no form values.

Reply With Quote
  #7  
Old August 5th, 2004, 10:03 AM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 22
Send a message via AIM to bocmaxima
Why not just add something to a hidden form field if it's denied and have CF look for that when the next page loads? The problem is that you will have to re-populate the form for the next page, but this is just a matter of re-creating it and re-hashing it in: no big deal.

<cfif Len(Form.denied) GT 1>
INTERMEDIATE CONTENT<br>
<form>
<< PUT YOUR FORM VARIABLES HERE >>
<input type="submit" value="Continue">
</form>

<cfelse>
<cfquery>
YOUR UPDATE QUERY
</cfquery>
REGULAR CONTENT
</cfif>

Hope that works.
-colin

Reply With Quote
  #8  
Old August 11th, 2004, 04:43 AM
DeepDown DeepDown is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Netherlands
Posts: 99 DeepDown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 1 m 8 sec
Reputation Power: 6
You can change the action attribute of the form through javascript:

<SCRIPT LANGUAGE = "JavaScript">
function approveSubmit(materialId, materialName){
document.approveDenyForm.materialId.value=materialId;
document.approveDenyForm.approveDeny.value=1;
document.approveDenyForm.facilityMessage.value='Please reconfirm the approving of MSDS ' + materialName;
document.approveDenyForm.submit();
}

function denySubmit(materialId, materialName){
document.approveDenyForm.materialId.value=materialId;
document.approveDenyForm.approveDeny.value=0;
document.approveDenyForm.facilityMessage.value='Please reconfirm the denying of MSDS ' + materialName;
document.approveDenyForm.action='intermediatepage.cfm';
document.approveDenyForm.submit();
}
</SCRIPT>

Hope it helps...
__________________
** Don't expect me to code your needs, but if I am able to help, I'm willing. Shout, grab and use the hand!
** Man can no more own the land we walk upon, as they can lay claim on the air that we breath
** DeepDown I'm addicted to structures.... ohw and music
** Almost forgot I had an account here [*o*]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Javascript Help with a form using Coldfusion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway