ruby - How to convert GET parameter to another format in Rails? -
I have a simple form in my train app, which can be used by all user's invoice
Filter by:
/ P>
& lt;% = form_tag invoices_path ,: method = & gt; 'Get'% & gt; & Lt;% = text_field_tag: Date, Parameters [: Date]% & gt; & Lt;% = submit_tag "search"%> & Lt;% end% & gt;
When a user enters a date in their preferred date format, e.g. 27/07/2014
, I get this code in the / invoices? Date = 2014-07-14
to be shown as, because it can be handled very easily and also better than / invoice = date = 25% 2F07% 2F2014
Looks.
What does convert have a GET parameter like this?
Thanks for any help.
First of all, the date is prettifying on customer , because you first Want pretty values to show in the query parameter.
form_tag
can be provided with onsubmit
callback:
& lt;% = form_tag invoices_path ,: Method = & gt; 'Get': OnSubmit = & gt; 'Validate the return (this)'% '& gt;
here valid ()
will be a JavaScript validation method which can be either true
or false
; You are free to value the beauty of that time and overwrite it.
Perhaps this is another great way to accomplish this, but the above one worked well for me, hope it helps.
Comments
Post a Comment