1

I am using a simple bind statement:

<cfform name="myform" method="post" >
   First Name: <cfinput type="text" name="firstname" required="yes"><br>
   <cfinput type="text" size="60" name="email1" 
       bind="cfc:/cfdocs/ZH/Controllers/CalendarServices.getEmailId()"> 
</cfform>

The function getEmailId looks like:

<cffunction name="getEmailId" access="remote">
    <cfargument name="firstname" type="string" required="true"> 
    <cfreturn "#arguments.firstname#@zhtest.com">
</cffunction> 

The bind works "locally," i.e., without using CFCs. The CFC works if I call it from a CFM page, but it is not being called from the bind.

I know CF is looking at the correct file. If I change the path or function name, or change the access to anything but "remote", it gives me an error. However, CF does not give me an error even though I have made the firstname argument required. What am I doing wrong? Is there a security setting that prevents CFCs from returning a value?

Community
  • 1
  • 1
user2485860
  • 21
  • 1
  • 1
  • 3
  • 1
    Your function has a mandatory argument and I don't see you passing one in your form code. – Dan Bracuk Sep 11 '13 at 03:23
  • 1
    Please do stop using `cfform`, `cfinput` and any other UI/JS functionality of ColdFusion. Learn to do it the right way using a JS library like jQuery. It will save you a lot of headaches down the road. – Scott Stroz Sep 11 '13 at 12:28
  • 2
    [Ben Forta blog - When Using ColdFusion Client Technologies No Longer Makes Sense](http://forta.com/blog/index.cfm/2012/11/25/When-Using-ColdFusion-No-Longer-Makes-Sense) – Miguel-F Sep 11 '13 at 19:27

1 Answers1

0

If you decide to use binding, change your cfinput tag to pass the variable and also add the bindonload attribute:

<cfinput type="text" size="60" name="email1" bind="cfc:/cfdocs/ZH/Controllers/.getEmailId({firstname})" bindonload="true"> 
dbetke
  • 28
  • 5