I have a route setup called /manage-children-list/ which displays a
typical "manager" screen, outputting "paged" results, with a search
keywords box, etc.
The route is defined with optional parameters like:
<parameter name="manage-children-list">
<struct>
<key name="event" value="manage.children.list" />
<key name="optionalParameters" value="page:1,pageSize:
4,orderBy:firstName,orderDirection:ASC,keywords:''" />
</struct>
</parameter>
So the listing page could take the form of:
http://dev.site.com/manage-children-list/1/4/firstName/ASC/billy bob/
Generating links internally using BuiltRouteURL is great, except that
I am just realizing that there is nothing allowing me to easily post
this form (in GET mode) with a properly routed url. The goal is that
when a user reaches:
http://dev.site.com/manage-children-list/
And selects the order column, page number, page size, and types in
some keywords, the URL that the form submits to will be:
http://dev.site.com/manage-children-list/1/4/firstName/ASC/billy bob/
I started writing a jquery plugin where I could do something like
this:
$("#children_form").routeURLPost({
"parameters": ["page", "pageSize", "orderBy",
"orderDirection"]
});
My plan was to have the plugin overwrite the submit() handler for the
form, and using the order of the array elements of "parameters", I
could build a slash delimited url based on the values of all of those
elements. Then I would dynamically change the "action" property of
the form and then submit.
I realize now that I am going to have to manually clean my keywords so
that the users don't type in garbage that messes up the url. I am
hoping that I can simply use the javascript encodeURI() function to
clean any textfields like keywords before throwing in the url.
Obviously I won't be submitting all of my forms this way. Only forms
where the resultant URL could actually be bookmarked and used
afterwords.
It also occurred to me that I could alternatively POST the form to
some server-side redirect where the server would take the form fields,
use BuildRouteURL, and then redirect to that URL. It seems like a bit
more traffic (two page requests) but maybe worth it to keep the JS
logic low and make the site more friendly for non-JS folks (who the
hell are those guys anyways?).
Any thoughts?
-Brian
--
You received this message because you are subscribed to Mach-II for CFML list.
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/mach-ii-for-coldfusion?hl=en
SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/