Best way to achieve this..

3 views
Skip to first unread message

Brettski

unread,
Sep 30, 2009, 10:16:41 PM9/30/09
to model-glue
Hi,

So I have a products page that has an dynamic div that's updated via
jquery. E.g the user can select a way to view produts (grid, list
etc).

Whats the best way to handle ajaxs update like this? just create a
folder under my views called "ajax" or something like that and call it
from my jquery?

RemotingService.cfc returns json, but in this case I want to update
the entire div, as sometimes it will be flash.

Many thanks,



Sean Corfield

unread,
Sep 30, 2009, 10:33:39 PM9/30/09
to model...@googlegroups.com
On Wed, Sep 30, 2009 at 7:16 PM, Brettski <brett...@gmail.com> wrote:
> Whats the best way to handle ajaxs update like this? just create a
> folder under my views called "ajax" or something like that and call it
> from my jquery?

So you're returning HTML to replace your div? Then you just want a
regular GET request through your Model-Glue app with a view/layout
that just returns the HTML you need.

You might find this blog entry by Brian Kotek useful:

http://www.briankotek.com/blog/index.cfm/2007/7/25/AJAX-Data-Requests-vs-AJAX-Content-Requests
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

Brettski

unread,
Sep 30, 2009, 10:36:57 PM9/30/09
to model-glue
ahhh yes I guess that's it..

so I will just return a

app/index.cfm?event=products.ajax

sounds like the way to go..

Thanks :)



On Oct 1, 12:33 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Wed, Sep 30, 2009 at 7:16 PM, Brettski <brettsk...@gmail.com> wrote:
> > Whats the best way to handle ajaxs update like this? just create a
> > folder under my views called "ajax" or something like that and call it
> > from my jquery?
>
> So you're returning HTML to replace your div? Then you just want a
> regular GET request through your Model-Glue app with a view/layout
> that just returns the HTML you need.
>
> You might find this blog entry by Brian Kotek useful:
>
> http://www.briankotek.com/blog/index.cfm/2007/7/25/AJAX-Data-Requests...
> --
> Sean A Corfield -- (904) 302-SEAN
> Railo Technologies US --http://getrailo.com/
> An Architect's View --http://corfield.org/

Dan Wilson

unread,
Oct 1, 2009, 10:18:45 AM10/1/09
to model...@googlegroups.com
Sorry for being short, my plane is boarding...

take a look at http://docs.model-glue.com/wiki/HowTos/Formats#Formats

Formats are a way to conditionally process elements based on a passed parameter. This could help reduce event duplication.



DW
--
“Come to the edge, he said. They said: We are afraid. Come to the edge, he said. They came. He pushed them and they flew.”

Guillaume Apollinaire quotes

Chuck

unread,
Nov 19, 2009, 5:34:26 PM11/19/09
to model-glue
Dan, there is absolutely no documentation at that link. Even your
comment is more verbose than the docs.

Charlie Griefer

unread,
Nov 19, 2009, 5:35:24 PM11/19/09
to model...@googlegroups.com
It's funny 'cuz it's true :)

On Thu, Nov 19, 2009 at 2:34 PM, Chuck <ch...@searisen.com> wrote:
Dan, there is absolutely no documentation at that link.  Even your
comment is more verbose than the docs.

--
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 model...@googlegroups.com
To unsubscribe from this group, send email to
model-glue+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en



--
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.

Brett Herford-Fell

unread,
Nov 19, 2009, 5:37:35 PM11/19/09
to model...@googlegroups.com

Ezra Parker

unread,
Nov 19, 2009, 5:37:19 PM11/19/09
to model...@googlegroups.com
@Chuck, there has recently been some reorganization of the wiki pages
-- try this link instead:

http://docs.model-glue.com/wiki/HowTos/HowToUseFormats

Sorry for the confusion.

--
Ezra Parker

Chuck

unread,
Nov 20, 2009, 12:08:50 PM11/20/09
to model-glue
@Brett, That link is this thread.

What I'm looking for is an example of all of this subject. I keep
seeing pieces. Anyone have a simple example they could post, of say a
login.cfm page, that has a login form, that is removed and replaced
with Welcome Bob Smith, without a refresh. Including a mode-glue.xml
snapshot and the files used to return the info?

You can see what I have at searisen.com/mg/ click login, then click
the new login. The page disappears, and I want the referenced page to
update with user info, the login button changing to logout and the
user's account info to appear. I'm sure this is done for every page
that requires authentication. At the very least I could have the main
page refresh (not sure how, since the returning view is inside the
small login window).

On Nov 19, 3:37 pm, Brett Herford-Fell <brettsk...@gmail.com> wrote:
> lol.
>
> check out my thread posted in this group before, may be of some help.
>
> http://groups.google.com/group/model-glue/browse_thread/thread/fa79c9...
>
> On Fri, Nov 20, 2009 at 9:35 AM, Charlie Griefer
>

Ezra Parker

unread,
Nov 20, 2009, 1:59:15 PM11/20/09
to model...@googlegroups.com
@Chuck,

I don't have any ready-made examples of something like that, although
I might be able to whip up a quick demo this weekend, if that would be
helpful (although I must admit that I'm not terribly familiar with
CF's built-in Ajax functionality, so I would use jQuery to do
something like this).

You might want to take a look at this blog post from Ray Camden, as it
presents an approach for solving this exact problem (albeit not in a
Model-Glue context):

http://www.coldfusionjedi.com/index.cfm/2007/11/29/ColdFusion-8-and-AjaxBased-Login

--
Ezra Parker

Chuck

unread,
Nov 20, 2009, 7:40:35 PM11/20/09
to model-glue
Thanks Ezra, I was already surfing Ray's pages for some help but
hadn't found this yet. I am close to a working version. Just need to
find out how to reference the form's fields in the controller....
tomorrow! (or Monday)

On Nov 20, 11:59 am, Ezra Parker <e...@cfgrok.com> wrote:
> @Chuck,
>
> I don't have any ready-made examples of something like that, although
> I might be able to whip up a quick demo this weekend, if that would be
> helpful (although I must admit that I'm not terribly familiar with
> CF's built-in Ajax functionality, so I would use jQuery to do
> something like this).
>
> You might want to take a look at this blog post from Ray Camden, as it
> presents an approach for solving this exact problem (albeit not in a
> Model-Glue context):
>
> http://www.coldfusionjedi.com/index.cfm/2007/11/29/ColdFusion-8-and-A...

sipa...@gmail.com

unread,
Nov 20, 2009, 8:31:27 PM11/20/09
to model...@googlegroups.com
The form fields will be available in the event object. This is where ALL input values go, in all circumstances.

The event object, as you know is available to you in your controller and in your views.






Sent from my Verizon Wireless BlackBerry

Chuck

unread,
Nov 21, 2009, 1:58:50 PM11/21/09
to model-glue
Right, I knew that from reading the docs. But event.getValue
('username') was returning an empty string. I created a couple new
functions in this post http://groups.google.com/group/model-glue/browse_frm/thread/f2f8c0b91f6c391a#
that told me that I needed to be using event.getValue('USERNAME') all
caps, and everything works fine now.

Thanks for the help,

Chuck

Chris Blackwell

unread,
Nov 22, 2009, 10:13:07 AM11/22/09
to model...@googlegroups.com
I'd "plaice" money on that being complete red-herring (sorry!!)

Coldfusion has a tendency to mess with struct key cases, and the output you're seeing in the other thread you linked to above is just an example of that.

CF is not case sensitive when accessing struct members, and neither is Model-Glue's event.getValue() method

The following code will work just fine.
<cfset event.setValue("FOO", "hello")>
<cfoutput>#event.getValue("foo")#</cfoutput>

something else has caused your code to start working.

Cheers, Chris

2009/11/21 Chuck <ch...@searisen.com>

--

Chuck

unread,
Nov 22, 2009, 4:31:32 PM11/22/09
to model-glue
I would of agreed with you, and still do, that ColdFusion isn't a
case sensitive language. I can't imagine what it was that 'caused' it
to start working, because only the moment I changed from username to
USERNAME did it start working, but to confirm. I just tested it with,
event.SetValue('loginResult', "#event.GetValue('USERNAME')
#,#event.GetValue('username')#"); and both returned the same value.
It boggles the mind, but whatever, it works.

On Nov 22, 8:13 am, Chris Blackwell <ch...@team193.com> wrote:
> I'd "plaice" money on that being complete red-herring (sorry!!)
>
> Coldfusion has a tendency to mess with struct key cases, and the output
> you're seeing in the other thread you linked to above is just an example of
> that.
>
> CF is not case sensitive when accessing struct members, and neither is
> Model-Glue's event.getValue() method
>
> The following code will work just fine.
> <cfset event.setValue("FOO", "hello")>
> <cfoutput>#event.getValue("foo")#</cfoutput>
>
> something else has caused your code to start working.
>
> Cheers, Chris
>
> 2009/11/21 Chuck <ch...@searisen.com>
>
> > Right, I knew that from reading the docs.  But event.getValue
> > ('username') was returning an empty string.  I created a couple new
> > functions in this post
> >http://groups.google.com/group/model-glue/browse_frm/thread/f2f8c0b91...
> > that told me that I needed to be using event.getValue('USERNAME') all
> > caps, and everything works fine now.
>
> > Thanks for the help,
>
> > Chuck
>
> > --
> > 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 model...@googlegroups.com
> > To unsubscribe from this group, send email to
> > model-glue+...@googlegroups.com<model-glue%2Bunsu...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages