Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax function if statements 1

Status
Not open for further replies.

JohnShell

Technical User
Aug 29, 2003
35
US
Hi,

Do not know how to do this. Using coldfusion. Have cfselect object (id="Decision") with 3 values - Select; Approved; Denied. Have two input buttons, Request Approved (id="approved") and Request Denied (id="denied"). The Approved is visible but disabled. The Denied is not visible. The user needs to select from "Decision" either Approved or Denied before he/she can submit. So when user selects Approved from drop-down I want to enable Request Approved submit button. If user selects Denied from drop-down I want the disabled Request Approved button to not be visible and the Request Denied button to be visible and enabled for submission. The respective buttons will be directed to their appropriate actions.
I am no further than this

function decide = function() {
var choice = document.getElementById("Decision");
var apprvd = document.getElementById("approved");
var deny = document.getElementById("denied");

if (choice.value = "Approved";

My limited knowledge goes no further.
Thanks for any help - John
 
You are almost there, all you need now is to set the visibility of each element.

Code:
[gray]function decide = function() {
    var choice = document.getElementById("Decision");
    var apprvd = document.getElementById("approved");
    var deny = document.getElementById("denied");
    
    if (choice.value =[red]=[/red] "Approved"[/gray]){
    denied.style.disabled="disabled";
    denied.style.visibility="hidden";
    apprvd.style.disabled=false;
    apprvd.style.visibility="visible";
    
     }
And reverse it for when denied is selected.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top