•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 425,983 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,631 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 1673 | Replies: 2 | Solved
![]() |
| |
•
•
Join Date: Mar 2008
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Help!
Hi, everbody!
I have this problem:
There is a “textbox” and a “submit” button.
“Submit button” is disabled until something is written within “text box”. I am not able to do this switch. Could anybody help me?
Here you are the code:
Thank you!
Hi, everbody!
I have this problem:
There is a “textbox” and a “submit” button.
“Submit button” is disabled until something is written within “text box”. I am not able to do this switch. Could anybody help me?
Here you are the code:
html Syntax (Toggle Plain Text)
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <cfform name="form1" id="form1" method="post" action=""> <cfinput type="text" name="Text" id="Text"> <cfinput type="submit" name="submit" disabled="disabled" id="submit" value="Submit"> </cfform> </body> </html>
Last edited by peter_budo : Apr 7th, 2008 at 7:01 pm. Reason: Keep It Organized - please use [code] tags
You need to use a javascript function for this:
Then in your form, add an OnBlur event to the textbox:
Javascript Syntax (Toggle Plain Text)
function ChangeButtonStatus() { if (document.getElementById("Text").value.length > 0) { document.getElementById("submit").disabled = false; } else { document.getElementById("submit").disabled = true; } }
Then in your form, add an OnBlur event to the textbox:
ColdFusion Syntax (Toggle Plain Text)
<cfinput type="text" name="Text" id="Text" OnBlur="ChangeButtonStatus()">
•
•
Join Date: Oct 2005
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 1
cmhamton has provided the solution - but just to expand:
So as to open the function to any form and any form objects:
sorry - haven't actually tested this...
So as to open the function to any form and any form objects:
function toggleObj(frmFld,frmBtn)
{
//frmFld = the Form Field to check for value
//frmBtn = the Form Button to disable/enable
if(frmFld.value.length>0)
{
frmBtn.disabled=false;
}
else
{
frmBtn.disabled=true;
}
}sorry - haven't actually tested this...
![]() |
•
•
•
•
•
•
•
•
DaniWeb ColdFusion Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the ColdFusion Forum
- Previous Thread: hash() md5 and url encoding issue
- Next Thread: Where to purchase


Hybrid Mode