Skip to main content
May 12, 2012
Answered

Bind ahref link (like cfinput) in cfform

  • May 12, 2012
  • 1 reply
  • 3513 views

Hi all

How can I output this value (that it correctly shown in a cfinput), also as a link? I am using cfform. As far as I can gather by googling I may have to use cfdiv or cflayout? Thank you

CFINPUT:

<cfinput type="text" name="COMPANY" label="Company" required="yes" width="200"
        bind="{UsersGrid.dataProvider[UsersGrid.selectedIndex]['COMPANY']}"
        onChange="UsersGrid.dataProvider.editField(UsersGrid.selectedIndex,

'COMPANY', COMPANY.text);">

MY ATTEMPT:

<a href="mysite.com?company=<cfoutput>#company#</cfoutput>">Company link</a>

    This topic has been closed for replies.
    Correct answer BKBK

    Searching around the internet I found this code which when put in the cfform shows a list of all the company names with a link. There is no bind but it is interesting as a starting point mixing html in a flash form.  What do you think?

    <cfformgroup type="panel" label="Current forums" visible="Yes" enabled="Yes">

    <cfformitem type="html" visible="Yes" enabled="Yes">

    <cfloop query="qNames">

    <cfoutput><a

    href="threads.cfm?fid=#Company#">#Company#</a><br

    /></cfoutput>

    </cfloop>

    </cfformitem>

    </cfformgroup>


    goodychurro1 wrote:

    <cfformitem>

    Spot on! I have also been looking into <cfformitem type="html"> and <cfformitem type="script">

    I came up with:

    <cfformitem type="html" bind="<a href=""mysite.com?company={company.text}"">Company link</a>">

       </cfformitem>


    1 reply

    BKBK
    Community Expert
    Community Expert
    May 12, 2012

    Something like

    <cfdiv id = "companyDiv" bind="<a href="""mysite.com?company=+{dt}+"">Company link</a>" />

    May 12, 2012

    Thanks for the reply BKBK I get this error:

    Invalid token . found on line 129 at column 49. 
     
    The CFML compiler was processing: 

    The tag attribute mysite, on line 129, column 43. 
    A cfdiv tag beginning on line 129, column 2.


    The error occurred in member_welcome.cfm: line 129

    127 :  128 : </cfformgroup>  129 : <cfdiv id = "companyDiv" bind="<a href="""mysite.com?company=+{dt}+"">Company link</a>" />  130 :  131 : <cfformgroup type="horizontal">  

    BKBK
    Community Expert
    Community Expert
    May 12, 2012

    My bad, I think. There should perhaps be 2 quotes after href=, not 3.