• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

set value for input text or textarea

Engaged ,
Jun 06, 2014 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,

Views

1.2K

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
community guidelines

correct answers 1 Correct answer

Guide , Jun 06, 2014 Jun 06, 2014

@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, CFMAI

...

Votes

Translate

Translate
Guide ,
Jun 06, 2014 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.

Votes

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
community guidelines
Engaged ,
Jun 10, 2014 Jun 10, 2014

Copy link to clipboard

Copied

LATEST

Thanks a million for the information and help,

Regards,

Iccsi,

Votes

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
community guidelines
Community Expert ,
Jun 07, 2014 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.

Votes

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
community guidelines
Resources
Documentation