Skip to main content
November 14, 2008
Question

html next to cfinput checkbox text

  • November 14, 2008
  • 5 replies
  • 601 views
I have a form which requires two a href links and surrounding text to appear to the right of a checkbox. When I put the html next to the closing tag, it does not display at all. When I place it in the label property, it shows the links as plain text. When I put the text in cfset tag outside the form, then call it from the label tag, again, it shows up as plain text. Is there any way to combine this the certification HTML with the checkbox so it will display properly?

Line of code:
<cfinput checked="yes" type="checkbox" name="ICertify" id="ICertify" label=#icertify# />

Output:
I certify that all information furnished is accurate and truthful. I also certify that I have read <a href=" http://www.usps.com/ibip/html/privacy_act1974.html" target="_blank">The USPS Privacy Act Statement</a> and <a href=" http://www.usps.com/ibip/html/privacy.html" target="_blank">PC Postage Privacy Principles</a>.

I'm brand new at ColdFusion, so be gentle in your answer.

Thank you,

Ernie
    This topic has been closed for replies.

    5 replies

    November 18, 2008
    What appears to be the underlying problem is that my cfform format is xml. When I change it to html, any number of options above produce the desired outcome just fine.

    My project is to create an input form that generates an xml output to an API, then processes the response. After a week trying to figure this out using the online versions of the CF8 documentation, I finally found two 'bonus' chapters online from a Sybex book, ColdFusion Developer's Handbook (based on CF5). But it requires setting up some antiquated 3rd party stuff which CF8 would probably do now. When I tried it, it didn't seem to work anyway (at least one of the web sites it refers to doesn't exist anymore).

    I'm at a loss as to how to complete this project.

    Thanks for any help you can provide.
    Inspiring
    November 18, 2008
    <a
    href="whateverpage.cfm"><cfoutput>#variables.ICertify#</cfoutput></a><cfinput
    type="checkbox" name="ICertify" id="ICertify" />

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    November 17, 2008
    Thank you for your help.

    I copied the code directly from your message, then tried several variations, including typing the text directly in between the label tags, excluding the <a> tags, etc.

    This is still not working - the text is not displaying where it should and in the way it should. I can't understand what's blocking the label from displaying.

    When I place the #icertify# cfset reference anywhere outside the form tags (enclosed in <cfoutput> tags), it returns exactly what I want - the text with clickable links. It seems that within the form, though, it won't function at all.

    I haven't made any changes to the original code posted last week. If there is anything in there that might be suppressing it from working, let me know.

    Thank you,

    Ernie
    November 14, 2008
    You can't do this:

    <cfinput type="checkbox" name="ICertify" id="ICertify" <a>#ICertify#</a> />

    Why? You can't have a tag within a tag. It's just not correct markup language syntax - which is why it errors.

    As Dan mentioned, put it in A tags. but forget about using the ColdFusion "label" attribute. Instead do this:

    <div>
    <label for="ICertify"><a>#ICertify#</a></label><cfinput type="checkbox" name="ICertify" id="ICertify" />
    </div>

    Mikey.
    Inspiring
    November 14, 2008
    Don't use a label. Just do this
    <cfinput><a>text</a>

    If it's not displaying, post the code. Something is wrong.
    November 14, 2008
    Hi Dan,

    Thank you for your response. I tried the <a> tags within the cfinput tag, and got an error. (<cfinput type="checkbox" name="ICertify" id="ICertify" <a>#ICertify#</a> />).

    Replacing the cfset call with plain text, or moving the <a> tags outside the cfinput tag, there's no error, but the text does not come out at all. (<cfinput type="checkbox" name="ICertify" id="ICertify" <a>Some Text</a> />)

    I've attached the cfm file.

    Thanks again for helping me through this.

    Ernie