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