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

.setList not setting date input nor a number input #175

Open
MrJoshFisher opened this issue Apr 19, 2023 · 9 comments
Open

.setList not setting date input nor a number input #175

MrJoshFisher opened this issue Apr 19, 2023 · 9 comments

Comments

@MrJoshFisher
Copy link

MrJoshFisher commented Apr 19, 2023

Hello all,,

I'm having an issue with the setList function whereby its not setting the values for a number field nor a date field,

<input type="number" name="pet_treat" value="" class="form-control" />
<input type="date" name="pet_birthday" value="" class="form-control" />

setList(
  [
    {
      "pet_treat": "2",
      "pet_birthday": "18-05-2020",
    }
   ]
)

end up getting the error:

jquery.min.js?ver=3.6.1:2 Uncaught TypeError: Cannot read properties of undefined (reading 'set')

it works if I change the inputs to type text, select or checkbox which work fine, just for some reason date and number fields cause the error

Any advice?

Cheer

@adeel94mirza
Copy link

adeel94mirza commented May 8, 2023

@MrJoshFisher I am facing a similar problem, did you find a solution?

Edit: I am facing the exact same problem

@adeel94mirza
Copy link

adeel94mirza commented May 8, 2023

#112 For future developers who run into this problem. I did not set the type property on the input which caused the issue.

@MrJoshFisher
Copy link
Author

@MrJoshFisher I am facing a similar problem, did you find a solution?

Edit: I am facing the exact same problem

No I didn't, I ended up using a different library entirely which was the basic jquery repeater library.

@bagus-dev
Copy link

Now I'm currently facing the same problem, is there already any solution for this?

@MrJoshFisher
Copy link
Author

Now I'm currently facing the same problem, is there already any solution for this?

Afraid not I ended up using a different library

@nicknicknickcheng
Copy link

Screenshot 2023-07-20 at 3 06 55 AM

I have made a simple change and that works

@its-sangam
Copy link

Actually input type date and number is missing in the bundle file, so we can solve the issue by adding simple codes in 3 places.

nu = function (a) { var b = {}, c = x(a, b); return ( (c.getType = function () { return "number"; }), c ); }, dt= function (a) { var b = {}, c = x(a, b); return ( (c.getType = function () { return "date"; }), c ); }, in variable declation section

        `number:nu,
         date:dt` in function A  variable assignment

: f.is('input[type="number"]') ? i("number", f) : f.is('input[type="date"]') ? i("date", f)
and i("number", 'input[type="number"]'), i("date", 'input[type="date"]'),
in return of function A

@thebradleysanders
Copy link

Screenshot 2023-07-20 at 3 06 55 AM

I have made a simple change and that works

This fixed the issue for me. Thank you.

@ykchan97
Copy link

i am using NPM so updating the source file is not preferable, I ended up using type="text" in HTML then change the type to "number" in the show function

HTML:

<div data-repeater-list="rewards">
    <div data-repeater-item>
        <input name="quantity" type="text" min="1" value="1" class="form-control"/>
    </div>
</div>

JS:

$('#repeater').repeater({
    initEmpty: false,
    show: function () {
        $(this).slideDown();
        this.querySelector('input[name$="[quantity]"]').setAttribute('type', 'number');
    },
    hide: function (deleteElement) {
        $(this).slideUp(deleteElement);
    },
});

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

No branches or pull requests

7 participants