Skip to content
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

defaultValues does not work with <input type="number" /> #20

Closed
HughxDev opened this issue Dec 20, 2015 · 3 comments
Closed

defaultValues does not work with <input type="number" /> #20

HughxDev opened this issue Dec 20, 2015 · 3 comments
Assignees
Labels

Comments

@HughxDev
Copy link

https://jsfiddle.net/yth50vsf/

Console reports:

Uncaught TypeError: Cannot read property 'set' of undefined

@DubFriend
Copy link
Owner

Ok, definitely a bug, I will look into this.

Thanks 😃

@DubFriend DubFriend self-assigned this Dec 20, 2015
@DubFriend DubFriend added the bug label Dec 20, 2015
@HughxDev
Copy link
Author

HughxDev commented Dec 12, 2016

Any update on this?

I also noticed the same thing happens with <input type="hidden" />.

Workaround for those running into the same issue: move your defaultValues to manual DOM manipulations under show.

$('.repeater').repeater({
  defaultValues: {
    "size": "S",
    // "qty": "1" // input[type=number]
    // "color-select": "#ffffff" // input[type=hidden]
  },
  show: function showRepeaterRow() {
    var $row = $(this);

    $row.find('.qty').eq(0).val(1);
    $row.find('.color-select-value').eq(0).val('#ffffff');
  },
  // ...
});

@DubFriend
Copy link
Owner

DubFriend commented Feb 10, 2017

hey sorry, I've been consumed with other projects and let this fall to the wayside. Yea the "show" callback will provide the opportunity for workarounds.

If interested in a PR, the addition would be to the file src/jquery.input.js which creates a common interface for all the supported input types

I'll close this issue, in favor of an equivalent one here #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants