I had the same issue here. The formhelper indeed is quite eager, but
prefixing your cookienames with a special name, solves it. I fixed it
by using the following jQuery plugins, referenced like this in my
code:
<script type="text/javascript" src="$siteRoot/Content/js/
jquery.cookie.js"></script>
<script type="text/javascript" src="$siteRoot/Content/js/
jquery.saveToCookie.js"></script>
Notice that there are 2 plugins available for jQuery: 'cookies' and
'cookie'. It seems the last one, which I used eventually, is more
popular, since more plugins are written based on it.
The 'saveToCookie' jQuery plugin is based on 'cookie' and
automatically handles restoring form values from cookies and saving
them "on change".
In my view, I used this:
$(document).ready(function(){
//Enable all inputs of elements with class 'cookiebindform' to
remember and store their values
$('.cookiebindform :input').saveToCookie({prefix:'cookie-'});
});
And that's it... Hope this helps too.
On 4 mei, 02:15, jake <[email protected]> wrote:
> There is no real reason to use the form helper, if it's not helping it
> may be better to go with plain HTML. I've had to do this several
> times when I have alot of javascript and nvelocity parser gets
> annoying.
>
> On Apr 28, 2:57 am, rheenen <[email protected]> wrote:
>
>
>
>
>
> > Hi all! I've been a RoR developer semi-actively in the past and
> > learning Castle MonoRail now because a client wants 'only
> > microsoft'... I encountered this:
>
> > On a form, I have a $FormHelper.TextField():
>
> > $FormHelper.TextField("ExampleSearch.ShipmentDocumentType", "%
> > {class='cookiebind'}")
>
> > the 'class='cookiebind'' part makes the field automatically store and
> > read it's value with a cookie named
> > 'ExampleSearch.ShipmentDocumentType' using the jQuery cookie plugin:
>
> > jQuery('.cookiebind').cookieBind();
>
> > This works perfectly, for storing it's value in the cookie, each time
> > the value is changed on the page.
>
> > Except... there seems to be a clash between the FormHelper trying to
> > retrieve the default value from the context, and jQuery's cookie
> > plugin trying to retrieve the value from the cookie.
>
> > What I would like, is for the FormHelper.TextField to try to retrieve
> > the default value not only form the PropertyBag, Request, Post etc.,
> > but also from the present cookies, just like the DataBinder does by
> > default.
>
> > Is there an option I have to supply? Or some kind of dictionary entry
> > added to the textfield's options?
>
> > Note: When I do NOT use the FormHelper's methods, but just plain HTML
> > (<input type="text" etc.), the jQuery cookie plugin retrieves the
> > value perfectly from the cookie...
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Castle Project Users" 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
> > athttp://groups.google.com/group/castle-project-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" 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
> athttp://groups.google.com/group/castle-project-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" 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/castle-project-users?hl=en.