Hi Chuck,

This may not be an approach you wish to take, but it is possible to
achieve the same result without modifying the RemotingService by using
a cfajaxproxy bind instead:

<cfset translateEvent = event.GetValue('xe_translate')>

<cfajaxproxy 
bind="url:RemotingService.cfc?method=executeEvent&returnformat=json&eventName=#translateEvent#&returnValues=translatedPhrase&phrase={txtphr...@keyup}"
onsuccess="setResult" />

<script type="text/javascript">
<!--
function setResult(returnValue) {
        document.getElementById('result').value = returnValue.translatedPhrase;
}
//-->
</script>

<cfform name="frm">
<p>
 Enter text to translate: <cfinput type="text" name="txtPhrase" value="" />
 Translation: <cfinput type="text" name="result" id="result" />
</p>
</cfform>

--
Ezra Parker



On Fri, Jan 15, 2010 at 6:21 PM, Chuck Savage <[email protected]> wrote:
> Dan,
>
> Here's an example.  I didn't want to post this in that trak ticket.
>
> From the translator example, I modified two files to make this.
> frmPhrase.cfm and Controller.cfc
>
> First the form,
>
> <cfset translateEvent = event.GetValue('xe.translate')>
>
> <cfform name="frm">
> <p>
>  Enter text to translate: <cfinput type="text" name="txtPhrase"
> value="" />
>  Translation: <cfinput type="text" name="result"
>    bind="cfc:translator.RemotingService.executeBindEvent(
>      eventName='#translateEvent#', phrase={txtphr...@keyup})" >
> </p>
> </cfform>
>
> The controller function
>
> <cffunction name="TranslatePhrase" access="public" returntype="void"
> output="no">
>  <cfargument name="event" type="any">
>
>    <cfset var phrase = arguments.event.getValue("phrase") />
>    <cfset var result = beans.translator.translate(phrase) />
>
>    <cfif not len(trim(phrase))>
>      <cfset arguments.event.SetValue("result", "Please enter a phrase
> to translate.")>
>    <cfelse>
>      <cfset arguments.event.SetValue("result", result)>
>    </cfif>
>
>    <cfset arguments.event.addTraceStatement("TranslatePhrase
> Results", result) />
>
> </cffunction>
>
>
> I tried using a bind on a cfdiv, but it kept sending two commas even
> if the text box was empty.  I couldn't figure it out.  As a result,
> the translation text box is too short to display the full error
> message, but at least you can see it working.
>
> The code for the eventBindEvent() in RemotingService.cfc is the same
> as posted above.
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en
>
-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to