[dx] Posted August 3, 2014 Share Posted August 3, 2014 Hi, I'm trying make some form for user registration, and I have multiple checkboxes for categories. So I'm using: <input type="checkbox" name="category[]" value="category_1"> Category 1<input type="checkbox" name="category[]" value="category_2"> Category 2<input type="checkbox" name="category[]" value="category_3"> Category 3<input type="checkbox" name="category[]" value="category_4"> Category 4etc.. It's all in <form> tag. When I go to console, I can see only value attribute like: <input type="checkbox" name="category[]" value> Category 1 But if I go to view source, there's html as it should be. What can cause it? This is reason why I can't fetch data correctly with .serializeArray(). How to solve it? Link to comment Share on other sites More sharing options...
Mudsaf Posted August 3, 2014 Share Posted August 3, 2014 Can you link the form code Link to comment Share on other sites More sharing options...
[dx] Posted August 3, 2014 Author Share Posted August 3, 2014 Nothing special, few input fields in <form> ... </form> Link to comment Share on other sites More sharing options...
Mudsaf Posted August 3, 2014 Share Posted August 3, 2014 There might be some missing quote or something similar in your code. Re-check the code. <input type="checkbox" name="category[]" value="category_1"> Category 1<input type="checkbox" name="category[]" value="category_2"> Category 2<input type="checkbox" name="category[]" value="category_3"> Category 3<input type="checkbox" name="category[]" value="category_4"> Category 4 ^Works fine Link to comment Share on other sites More sharing options...
[dx] Posted August 4, 2014 Author Share Posted August 4, 2014 Even work on jsbin or jsfiddle, but not for me. Those value are just empty.. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 4, 2014 Share Posted August 4, 2014 Are you sure you dont have any code php if php generated or javascript manipulating this value attribute. Are you sure you are not using two single quotes to make double quote by mistake. Is it saved using utf 8 or 16 encoding. Link to comment Share on other sites More sharing options...
[dx] Posted August 4, 2014 Author Share Posted August 4, 2014 Hi dsonesuk, Thank your for reply. I tryed both, php generating and static html like value="something". I'm sure, checked twice, that it's double quotes correctly, and it's utf8. Link to comment Share on other sites More sharing options...
JamesB Posted August 4, 2014 Share Posted August 4, 2014 can you upload the file containing that code? Link to comment Share on other sites More sharing options...
johncc Posted August 5, 2014 Share Posted August 5, 2014 (edited) Are you expecting to access an array category[], because category[] is just your checkbox name. What are you applying .serializeArray() to? Edited August 5, 2014 by johncc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now