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>
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">
Thanks bkbk that sorted out that error but now I get a js alert error:
"Bind failed, element not found: dt"
I imagine this is because I have not selected a company yet so it has no data to bind, but that is the same case in the cfinputs and they don't thorw an error:
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);">
goodychurro1 wrote:
Thanks bkbk that sorted out that error but now I get a js alert error:
"Bind failed, element not found: dt"
I imagine this is because I have not selected a company yet so it has no data to bind, but that is the same case in the cfinputs and they don't thorw an error:
You should have just filled in the field name in place of my 'dt'! Something like this
<cfdiv id = "companyDiv" bind="<a href=""mysite.com?company=+{company}+"">Company link</a>" />
Thanks bkbk, I tried that and get two errors:
1)Bind failed element not found: COMPANY
Bind failed element not found: companyDIV
Code: <cfdiv id = "companyDiv" bind="<a href=""mysite.com?COMPANY=+{COMPANY}+"">Company link</a>" />
2) I also tried using the code in the cfinput to see if it would work but I get an error:
Error parsing bind expression at character 29:{ in Company link
Code:
<cfdiv id = "companyDiv" bind="<a href=""mysite.com?COMPANY=+{UsersGrid.dataProvider
[UsersGrid.selectedIndex]['COMPANY']}+"">Company link</a>" />
Thanks for the input BKBK I tried with three different lines but I still get COMPANY not defined, I am using the code within the cfformgroup tag:
1)
<cfdiv id = "companyDiv" bindOnLoad="true" bind="<a href=""mysite.com?company=+
{COMPANY}+"">Company link</a>" />
2)
<cfdiv id = "companyDiv" bindOnLoad="yes" bind="<a href=""mysite.com?company=+
{COMPANY}+"">Company link</a>" />
3)
<cfdiv id = "companyDiv" bindOnLoad="no" bind="<a href=""mysite.com?company=+
{COMPANY}+"">Company link</a>" />
Cheers, OK I put the bindOnLoad on the cfinput COMPANY field:
<cfinput type="text" bindOnLoad="true" name="COMPANY" label="Company" required="yes" width="200"
bind="{UsersGrid.dataProvider[UsersGrid.selectedIndex]['COMPANY']}" onChange="UsersGrid.dataProvider.editField
(UsersGrid.selectedIndex, 'COMPANY', COMPANY.text);">
And this line also within the cfformgroup tag:
<cfdiv id = "companyDiv" bind="<a href=""mysite.com?company=+{COMPANY}+"">Company link</a>" />
I get these three errors:
bind failed element not found COMPANY
Element not found COMPANY
Element not found companyDiv
Message was edited as I changed the case of database fields
I overlooked the fact you might be using a Flash form. The cfdiv tag is HTML. It won't work with Flash. In any case, not as we want here. However, we're on the right track. Convince yourself that this works:
<cfform>
<cfinput name="company" type="text" value="myCompany">
</cfform>
<cfdiv id = "companyDiv" bind="<a href=""mysite.com.cfm?company=+{company}+"">Company link</a>" />
The challenge is to find an equivalent solution for a Flash form (update: which I am looking into). Alternatively, you could also look into converting your form into HTML.
Hi BKBK
I changed the cfform format and the cfgrid format to html but that makes none of the binds work!
I tried this code below the form and it works showing mycompany as the parameter, but the point obviously is that it is not dynamic.
The link doesn't have to be within the form. Maybe there is a way to set a variable with the value from the cfinput? Or have we hit a flash induced brick wall? Cheers
<cfform>
<cfinput name="company" type="text" value="myCompany">
</cfform>
<cfdiv id = "companyDiv" bind="<a href=""mysite.com.cfm?company=+{company}+"">Company link</a>" />
goodychurro1 wrote:
I changed the cfform format and the cfgrid format to html but that makes none of the binds work!
It's usually not sufficient to change the format from flash to html. You may have to change the code in the bind expression from actionscript to an html-compatible form.
I tried this code below the form and it works showing mycompany as the parameter, but the point obviously is that it is not dynamic.
<cfform>
<cfinput name="company" type="text" value="myCompany">
</cfform>
<cfdiv id = "companyDiv" bind="<a href=""mysite.com.cfm?company=+{company}+"">Company link</a>" />
I didn't forget the requirement of passing the value dynamically via binding. This is just a proof of concept to show that there is a solution for HTML forms.
The link doesn't have to be within the form. Maybe there is a way to set a variable with the value from the cfinput? Or have we hit a flash induced brick wall?
Flash forms are trickier to manipulate in ColdFusion than HTML forms. However, there is always a way around most problems.
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>
North America
Europe, Middle East and Africa
Asia Pacific