3 Replies Latest reply: Jun 10, 2014 2:02 PM by iccsi RSS

    set value for input text or textarea

    iccsi Community Member

      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,

        • 1. Re: set value for input text or textarea
          Carl Von Stetten MeganK

          @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.

          • 2. Re: set value for input text or textarea
            BKBK CommunityMVP

            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.

            • 3. Re: set value for input text or textarea
              iccsi Community Member

              Thanks a million for the information and help,

              Regards,

               

              Iccsi,