Highlighted

set value for input text or textarea

Engaged ,
Jun 06, 2014

Copy link to clipboard

Copied

I can use following code to set cfinput text and cftextarea a value from my database, but following code fails for html standard components like

<input type="text"> or textarea.

<CFINPUT type="text" name="Mytext" id="idMyText" value="#mySP.MyValue#" />

Are there any way to set value from database for standard controls?

Your help and information is great appreciated,

regards,

Iccsi,

Most Valuable Participant
Correct answer by Carl_Von_Stetten | Most Valuable Participant

@Iccsi,

You didn't give much of an explanation of "following code fails", so we're shooting in the dark here.  First thought though is: did you wrap the HTML form or input tag with a <cfoutput> tag?  The <cfform> tag includes the functionality of <cfoutput> already, which might be why your <cfinput> code works but <input> doesn't.

Rule of thumb when trying to output ColdFusion variable values to the page: if you aren't inside a ColdFusion tag designed to output data to the page (like CFFORM, CFMAIL, etc.), you need to have an enclosing <cfoutput> tag somewhere.

-Carl V.

Views

884

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

set value for input text or textarea

Engaged ,
Jun 06, 2014

Copy link to clipboard

Copied

I can use following code to set cfinput text and cftextarea a value from my database, but following code fails for html standard components like

<input type="text"> or textarea.

<CFINPUT type="text" name="Mytext" id="idMyText" value="#mySP.MyValue#" />

Are there any way to set value from database for standard controls?

Your help and information is great appreciated,

regards,

Iccsi,

Most Valuable Participant
Correct answer by Carl_Von_Stetten | Most Valuable Participant

@Iccsi,

You didn't give much of an explanation of "following code fails", so we're shooting in the dark here.  First thought though is: did you wrap the HTML form or input tag with a <cfoutput> tag?  The <cfform> tag includes the functionality of <cfoutput> already, which might be why your <cfinput> code works but <input> doesn't.

Rule of thumb when trying to output ColdFusion variable values to the page: if you aren't inside a ColdFusion tag designed to output data to the page (like CFFORM, CFMAIL, etc.), you need to have an enclosing <cfoutput> tag somewhere.

-Carl V.

Views

885

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 06, 2014 0
Most Valuable Participant ,
Jun 06, 2014

Copy link to clipboard

Copied

@Iccsi,

You didn't give much of an explanation of "following code fails", so we're shooting in the dark here.  First thought though is: did you wrap the HTML form or input tag with a <cfoutput> tag?  The <cfform> tag includes the functionality of <cfoutput> already, which might be why your <cfinput> code works but <input> doesn't.

Rule of thumb when trying to output ColdFusion variable values to the page: if you aren't inside a ColdFusion tag designed to output data to the page (like CFFORM, CFMAIL, etc.), you need to have an enclosing <cfoutput> tag somewhere.

-Carl V.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2014 0
iccsi LATEST
Engaged ,
Jun 10, 2014

Copy link to clipboard

Copied

Thanks a million for the information and help,

Regards,

Iccsi,

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 10, 2014 0
Adobe Community Professional ,
Jun 07, 2014

Copy link to clipboard

Copied

iccsi wrote:

... but following code fails for html standard components like

<input type="text"> or textarea.

<CFINPUT type="text" name="Mytext" id="idMyText" value="#mySP.MyValue#" />

Strictly speaking, the code doesn't fail. It simply stores the string "#mySP.MyValue#" as the value of form.Mytext.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 07, 2014 0