Fat.. You cheeky southern fairy!!!

---
James Allen
E: [email protected]
Blog: http://jamesallen.name
Twitter: @CFJamesAllen (Coldfusion / Web development)
Twitter: @jamesallenuk (General)


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Sir Rawlins
Sent: 17 July 2009 17:00
To: model-glue
Subject: [Model-Glue] Re: using cfajaxproxy?


Hello Jim,

Managed to solve this with the great efforts of my fat northern friend
James Allen. I've seen this issue before myself when working with web
services and it's a bitch to diagnose and I believe generally
considered to be a bug in CF.

http://jamesallen.name/index.cfm/2008/1/30/Bug-in-calling-CFCs-remotely-via-
the-URL-when-using-applicationcfc

I removed my onRequest() method from my application.cfc and it's now
returning data as expected!.

Hope this helps someone else in the future.

Rob

On 17 July, 16:51, Jim <[email protected]> wrote:
> Are you forcing a return type by passing an argument in to dictate the
return behavior? Such as returnFormat="JSON" and returnType="string" or do
you have it hard-coded in the CFC?
>
> Have an example of a function that's returning NULL I can look at? You can
send it off list. Just need the function and component definition.
>
> --- On Fri, 7/17/09, Sir Rawlins <[email protected]>
wrote:
>
> From: Sir Rawlins <[email protected]>
> Subject: [Model-Glue] Re: using cfajaxproxy?
> To: "model-glue" <[email protected]>
> Date: Friday, July 17, 2009, 8:21 AM
>
> Thanks Jim,
>
> I'm just working this out as we speak, seems it's not just my MG stuff
> which isnt returning values, even when testing with some basic CFC's
> and cfajaxprox they're all returning NULL instead of the string value
> I expect, I'm trying to solve the error as we speak.
>
> Rob
>
> On 17 July, 15:03, Jim <[email protected]> wrote:
>
>
>
> > I believe you'll need to return them to JS as the return value for the
original call. So if it's successful, you return the value from your
controller, if it's a validation error, you need to return that.
>
> > Like I said, I am not uber familiar with Mode-Glue's remoting
specifically, but it seems this is how it should be. Once you make the
request and the items are in the collection, when the request terminates,
the items are lost. So, if you want JS to have them, you need to return them
as the return value.
>
> > Sorry I can't be of more help about MG specifics, if this were ColdBox
I'd write it for you! :)
>
> > --- On Fri, 7/17/09, Sir Rawlins <[email protected]>
wrote:
>
> > From: Sir Rawlins <[email protected]>
> > Subject: [Model-Glue] Re: using cfajaxproxy?
> > To: "model-glue" <[email protected]>
> > Date: Friday, July 17, 2009, 6:22 AM
>
> > Yeah thanks Jim, frustrated I missed it myself.
>
> > I'm still a little confused as to how I access the ValidationErrors
> > struct though? my controller method places them into the event object
> > but I have no idea how to access that from the JS, any ideas?
>
> > Rob
>
> > On 17 July, 14:05, Jim <[email protected]> wrote:
>
> > > Wow, yeah, should have seen that!!!!
>
> > > --- On Fri, 7/17/09, Sir Rawlins <[email protected]>
wrote:
>
> > > From: Sir Rawlins <[email protected]>
> > > Subject: [Model-Glue] Re: using cfajaxproxy?
> > > To: "model-glue" <[email protected]>
> > > Date: Friday, July 17, 2009, 6:01 AM
>
> > > Ok, for those interested I found the error with this, seems i wasn't
> > > using cfajaxproxy quite right:
>
> > > <cfajaxproxy cfc="ModelGlue.gesture.remoting.AbstractRemotingService"
> > > jsclassname="RemoteService" />
>
> > > <h1>This is a form.</h1>
>
> > > <script type="text/javascript">
> > >     var NewProxy = new RemoteService();
> > >     var result = NewProxy.executeEvent("submit.contact_form", {},
> > > "ValidationErrors");
> > > </script>
>
> > > Didn't realize I had to create a new instance of the JS class before
> > > calling it's methods.
>
> > > Rob
>
> > > On 16 July, 21:24, Sir Rawlins <[email protected]>
> > > wrote:
>
> > > > Yeah is a bit strange, I mean, if it works like this then I'm happy
> > > > enough. I'm not sure if it's working though.
>
> > > > I'm now trying to make a test call to the object but I'm getting JS
> > > > errors.
>
> > > > <script type="text/javascript">
> > > >         var callResult =
RemoteService.executeEvent("submit.contact_form",
> > > > {}, "ValidationErrors");
> > > > </script>
>
> > > > Results in the error:
>
> > > > Message: Object doesn't support this property or method
> > > > Line: 33
> > > > Char: 2
> > > > Code: 0
> > > > URI:http://localhost:81/index.cfm/modal.contact_form
>
> > > > Which would suggest to me that the proxy isn't being created
properly
> > > > and isn't exposing it's executeEvent() method? I don't know, I'm too
> > > > new at this.
>
> > > > Rob
>
> > > > On 16 July, 21:11, whostheJBoss <[email protected]> wrote:
>
> > > > > Yes, that is weird, hmmm
>
> > > > > On Jul 16, 1:05 pm, Sir Rawlins
<[email protected]>
> > > > > wrote:
>
> > > > > > Yeah, what's also weird is that if I set cfajaxproxy to the full
path
> > > > > > of the abstract object like so:
>
> > > > > > <cfajaxproxy
cfc="ModelGlue.gesture.remoting.AbstractRemotingService"
> > > > > > jsclassname="RemoteService" />
>
> > > > > > The error isn't thrown :-s quite strange.
>
> > > > > > Rob
>
> > > > > > On 16 July, 21:03, whostheJBoss <[email protected]>
wrote:
>
> > > > > > > Oops, yeah, since it extends AbstractRemotingService, I
checked
> > > > > > > that... it's method is set to remote so you don't need
anything other
> > > > > > > than what you have.
>
> > > > > > > Hmm, odd...
>
> > > > > > > On Jul 16, 12:33 pm, Sir Rawlins
<[email protected]>
> > > > > > > wrote:
>
> > > > > > > > Hey, thanks for the reply.
>
> > > > > > > > My RemotingService.cfc is the one which comes with MG, my
> > > > > > > > understanding was that I didnt have to place any methods in
it at all,
> > > > > > > > just use the default ones from the object it extends.
>
> > > > > > > > <cfcomponent output="false"
> > > > > > > > extends="ModelGlue.gesture.remoting.AbstractRemotingService"
> > > > > > > > hint="Exposes your Model-Glue application to remote
clients.">
>
> > > > > > > >         <!---
> > > > > > > >         If you use a file other than index.cfm as your
application's
> > > > > > > > template, change this line.
> > > > > > > >         --->
> > > > > > > >         <cfset template = "/index.cfm" />
>
> > > > > > > > </cfcomponent>
>
> > > > > > > > Is that not correct?
>
> > > > > > > > Thanks,
>
> > > > > > > > Rob
>
> > > > > > > > On 16 July, 18:55, whostheJBoss <[email protected]>
wrote:
>
> > > > > > > > > I'll ask the obvious...
>
> > > > > > > > > On your function in RemotingService.cfc, do you have
access="remote" ?
>
> > > > > > > > > Example:
>
> > > > > > > > > <cffunction name="ajaxLogin" access="remote"
returntype="boolean"
> > > > > > > > > output="false" hint="I log the user in via AJAX">
>
> > > > > > > > > On Jul 16, 10:36 am, Sir Rawlins
<[email protected]>
> > > > > > > > > wrote:
>
> > > > > > > > > > Hello Guys,
>
> > > > > > > > > > Well, first time out playing with AJAX related stuff.
Done a little
> > > > > > > > > > reading through the MG docs on how to get my events
setup and ready
> > > > > > > > > > for remoting, the basic task here is to take my existing
HTML based
> > > > > > > > > > 'contact us' page and make it into a small modal window
contact form.
> > > > > > > > > > all the processing for the form is already handled in an
event called
> > > > > > > > > > submit.contact_form.
>
> > > > > > > > > > I'm a total n00b to this so please forgive me if I'm
making a real
> > > > > > > > > > mess of things. I've configured my submit.contact_form
event to look
> > > > > > > > > > like so:
>
> > > > > > > > > >                 <event-handler
name="submit.contact_form">
> > > > > > > > > >                         <broadcasts>
> > > > > > > > > >                                 <message
name="contactFormSubmitted" />
> > > > > > > > > >                         </broadcasts>
> > > > > > > > > >                         <results>
> > > > > > > > > >                                 <result name="success"
do="thanks" requestFormat="HTML" />
> > > > > > > > > >                                 <result name="failed"
do="get-in-touch" requestFormat="HTML" />
> > > > > > > > > >                         </results>
> > > > > > > > > >                 </event-handler>
>
> > > > > > > > > > This way the user is only routed around to different
pages if the
> > > > > > > > > > request is made by HTML, correct? Now, my controller
creates an struct
> > > > > > > > > > in the event called 'ValidationErrors' if the form is
not completed
> > > > > > > > > > properly, this is what I'll be needing to get my hands
on once the
> > > > > > > > > > form submit has been made to decide if to display errors
or give a
> > > > > > > > > > 'thanks' message to the user.
>
> > > > > > > > > > Now, on my cfm page which contains the form I'm trying
to use
> > > > > > > > > > cfajaxproxy to connect to the RemotingService.cfc which
comes with
> > > > > > > > > > MG:G in order for me to make my requests, is that
correct? however,
> > > > > > > > > > this is throwing an error when I'm viewing the page,
like so:
>
> > > > > > > > > > <cfajaxproxy cfc="RemotingService"
jsclassname="RemotingService" />
>
> > > > > > > > > > <h1>This is a form.</h1>
>
> > > > > > > > > > And the error is:
>
> > > > > > > > > > The specified function '' on the CFC RemotingService
must have its
> > > > > > > > > > access attribute set to 'remote'.
>
> > > > > > > > > > The error occurred in
C:\XXXXXXXXXXXXXXXXXXXXXXXX\Views\Communication
> > > > > > > > > > \frmModalContactForm.cfm: line 3
>
> > > > > > > > > > Can anyone shed some light on what I'm doing wrong here?
Like a say,
> > > > > > > > > > It's probably a really obvious mistake but it's all
Alien to me and
> > > > > > > > > > I'm feeling confused.
>
> > > > > > > > > > Thanks again,
>
> > > > > > > > > > Rob


--~--~---------~--~----~------------~-------~--~----~
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

For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---

Reply via email to