views:

29

answers:

1

I am using jquery ui dialog to display form. Unfortunately, this function clears hidden input with csrf token inside my form. Can I somehow force dialog not to clear this field or do I have to store this token somewhere and set the proper field myself?

A: 

Non-ideal situation, but why don't you disable CSRF protection for the view in question? Or do you have loads of forms in this kind of dialog?

Alternatively, why not have some JS that scrapes the token, parks it elsewhere in the DOM and then you override the problematic function to clone the token input back to its original place once all other activity is done?

stevejalim
The first option is no good for me. I thought about the second, but I didn't like it too much. It seems as the only solution though. Thanks.
gruszczy
Agreed, it ain't pretty, but if it works, then that's good.
stevejalim