New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expected Hash (got String) for param `date' #227

DevanB opened this Issue Sep 13, 2013 · 7 comments


7 participants

DevanB commented Sep 13, 2013

When using pickadate in Rails, I get the following error when submitting a form:

expected Hash (got String) for param `date'

Here is my form and schema for the two fields:

I can remove pickadate classes from the fields, and everything works fine, but when those two fields have the pickadate classes, I get that error.

Thanks for any help guys!


This comment has been minimized.


amsul commented Sep 20, 2013

This isn’t a bug with the library - but rather one with your rails application schema. Not sure but I believe if you just set the type to string instead, it should be fine.

@amsul amsul closed this Sep 20, 2013


This comment has been minimized.

jerefrer commented Jan 12, 2014

Turns out the error is caused by the hidden _submit field. Apparently Rails doesn't like fields named like this object[field_name]_submit.

But is it even normal to have a field named like this ? I've never seen anything like it. Maybe what you meant to do with the suffix was to have something like object[field_name_suffix]. Didn't you ?

Anyway, to get rid of the error I've just set the hiddenSuffix option to empty string: hiddenSuffix: ''. Worked for pickatime too.


This comment has been minimized.

ramaboo commented Feb 24, 2014

I had this issue as well.


This comment has been minimized.

kylekeesling commented Feb 25, 2014

+1 - It looks like it's only injected when you specify the formatSubmit option.


This comment has been minimized.


amsul commented Mar 5, 2014

@jerefrer, yep, that’s definitely the case. There’s a PR that looks to resolve this issue - I’ll try to get around to this for the next release.


This comment has been minimized.

retoo commented Mar 17, 2014

The following snippet provides a workaround, which converts hidden attributes foo[bar]_submit to foo[bar_submit] (notation as suggested by jerefrer).

I hope we can fix this properly in the library, the workaround is rather hackish.

/* see */
var BAD_ATTR_RE = /\]_submit$/;
$(function() {
  $('form').submit(function(event) {
    var target = $(;
    $.each(target.find("input[type=hidden]"), function(i, el) {
      var e = $(el);
      var name = e.attr('name');
      if (name.match(BAD_ATTR_RE)) {
        var newName = name.replace(BAD_ATTR_RE, "_submit]");
        e.attr("name", newName)

This comment has been minimized.

acrolink commented May 13, 2016

@jerefrer Thank you very much. You suggestion works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment