4 Replies Latest reply: Mar 10, 2008 1:24 PM by paross1 RSS

    How Very Odd

    Dan Bracuk Community Member
      This is an observation, I'm not looking for assistance.

      I have a reuseable form, so I made it an included file. The general idea is:

      <cfset some_variable="some value">
      <cfoutput>
      <cfinclude the file with the form>

      In the form, if I do this
      <cfinput type="submit" value="#some_variable#">
      Then the button is labelled with the value of the variable, as expected.

      But, if I do this:
      <input type="submit" value="#some_variable#">
      then the button gets labelled with the string literal, #some_variable#.

      I find that odd.
        • 1. Re: How Very Odd
          Newsgroup_User Community Member
          It is because the first one is a CFINPUT and will process the CFML.

          The other is an HTML element and will not process the CFML without putting
          <cfoutput> tags around it, like this:

          <input type="submit" value="<cfoutput>#some_variable#</cfoutput>">

          --
          Ken Ford
          Adobe Community Expert - Dreamweaver
          Fordwebs, LLC
          http://www.fordwebs.com


          "Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
          news:fr3v5q$mfk$1@forums.macromedia.com...
          > This is an observation, I'm not looking for assistance.
          >
          > I have a reuseable form, so I made it an included file. The general idea
          > is:
          >
          > <cfset some_variable="some value">
          > <cfoutput>
          > <cfinclude the file with the form>
          >
          > In the form, if I do this
          > <cfinput type="submit" value="#some_variable#">
          > Then the button is labelled with the value of the variable, as expected.
          >
          > But, if I do this:
          > <input type="submit" value="#some_variable#">
          > then the button gets labelled with the string literal, #some_variable#.
          >
          > I find that odd.
          >

          • 2. How Very Odd
            paross1 Community Member
            Did you enclose your <input> tag in <cfoutput></cfoutput> tags? I know that you did it in the template calling the include, but does it work if you do it distinctly in the include itself?

            Phil
            • 3. Re: How Very Odd
              Dan Bracuk Community Member
              quote:

              Originally posted by: paross1
              Did you enclose your <input> tag in <cfoutput></cfoutput> tags? I know that you did it in the template calling the include, but does it work if you do it distinctly in the include itself?

              Phil

              I did what I described in the opening post and carried on with the job at hand.
              • 4. How Very Odd
                paross1 Community Member
                Per the description for the cfinclude tag in LiveDocs....

                The included file must be a syntactically correct and complete CFML page. For example, to output data from within the included page, you must have a cfoutput tag, including the end tag, on the included page, not the referring page. Similarly, you cannot span a cfif tag across the referring page and the included page; it must be complete within the included page.

                Phil