Monday, 15 February 2010

coldfusion - Is it possible to disable a cfinput type=text field using a conditional cfscript if statement? -


I have a dynamically populated text field with cfform If user comes to the user form on the form, then the database is empty, I would like to "enable" the field so that they can fill in the information and submit the form. However, if they have already done this and have a database population, then I would like to "disable" the fields.

Basically, I want to:

  & lt; Cfscript & gt; If (define "query.column")} {cfinput fields} disable  

Is it possible? If not, any ideas about how to accomplish this?

This is what I mean by my comment, I do not believe you have cfscript There is a reason for what to do within the tag. You are already using tag syntax for your form, when you are creating a form, just check your status (s). For example, now you have something like this:

  & lt; Html & gt; & Lt; Top & gt; & Lt ;! - Here are some codes - & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;! - Here are some codes - & gt; & Lt; Cfform ... & gt; & Lt; Cfinput type = "text" ... & gt; & Lt; / Cfform & gt; & Lt ;! - Here are some codes - & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

The suggestion I am giving is something to do:

  & lt; Html & gt; & Lt; Top & gt; & Lt ;! - Here are some codes - & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;! - Here are some codes - & gt; & Lt; Cfform ... & gt; & Lt; Cfif isDefined ("query.column") & gt; & Lt; Cfinput type = "article" disabled = "disabled" ... & gt; & Lt; Cfelse & gt; & Lt; Cfinput type = "text" enabled = "enabled" ... & gt; & Lt; / Cfif> & Lt; / Cfform & gt; & Lt ;! - Here are some codes - & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Use similar conditions in tags, as you form a form for any other field or button etc.


No comments:

Post a Comment