Skip to main content
Code Review

Timeline for Clone Div and change input control

Current License: CC BY-SA 4.0

18 events
when toggle format what by license comment
Jan 29, 2023 at 0:54 comment added Ismael Miguel @Jefferson I've added the requested counter. 100% CSS, which means, you have to do a lot less work and you don't have to implement anything in JavaScript. As long as it has it's little space, it will always be there.
Jan 29, 2023 at 0:53 history edited Ismael Miguel CC BY-SA 4.0
Added CSS-only counter.
Jan 29, 2023 at 0:39 comment added Jefferson That would be great to see
Jan 29, 2023 at 0:36 comment added Ismael Miguel @Jefferson No. It has to be updated in the addRow() and deleteRow() functions. You can't just increment 1 to some counter and assume everything is fine. You have to go through all the inputs and set the new placeholder for each one. Besides, it doesn't look obvious as to what that field is for, specially for a less tech-savvy user. That's why I just used the "boring" placeholder="Row name". It's obvious for everybody. If you want a counter, like the example image, the best idea is to do what the example image has. But, I can re-create what you had, if you want.
Jan 29, 2023 at 0:30 comment added Jefferson Would you just update the $input_group using find?
Jan 29, 2023 at 0:27 comment added Ismael Miguel @Jefferson That's completely outside the scope of this review, and completely outside the scope of your code. My implementation is just a baseline for the code you have, with the extra functionality to delete rows (something that was kinda part of the code, but wasn't functional). Updating the placeholder is possible, but just a complete waste of effort, in my opinion. But if you want, I can add that bit into the code, as it was part of the original code.
Jan 29, 2023 at 0:24 comment added Jefferson I also don’t see it updating the placeholder can that not be done using this logic ?
Jan 29, 2023 at 0:18 comment added Jefferson Thanks what if I wanted to set them on a edit view? Meaning if I have 5 records that I need to add into the inputs how would I do that ?
Jan 29, 2023 at 0:10 vote accept Jefferson
Jan 29, 2023 at 0:03 comment added Ismael Miguel @Jefferson Then you should have a <form> somewhere. On that form, you add an event listener to the <form> and then just do $(this).serialize() into $.post() or $.ajax(). api.jquery.com/serialize <-- This explains everything. Since none of that code is part of the review, this is as far as I can help. If you check the $.post documentation (api.jquery.com/jQuery.post/…) you can see that the data argument accepts a PlainObject like {field: 'data'} or String (which is the result of $.serialize).
Jan 29, 2023 at 0:01 comment added Jefferson So I have to build a object client side with all the data and then make a Ajax call .
Jan 28, 2023 at 23:59 comment added Ismael Miguel @Jefferson That depends on what language you're talking about, and if it is in the client or server-side.
Jan 28, 2023 at 23:58 comment added Jefferson Thanks for the review one question is how would I get the collections of ‘name[]‘ ?
Jan 28, 2023 at 21:34 history edited Ismael Miguel CC BY-SA 4.0
added 712 characters in body
Jan 28, 2023 at 19:02 history edited Ismael Miguel CC BY-SA 4.0
More improvements on explanation and code
Jan 28, 2023 at 18:36 history edited Ismael Miguel CC BY-SA 4.0
Improved comments and the code a tiny bit.
Jan 28, 2023 at 18:27 history edited Ismael Miguel CC BY-SA 4.0
added 119 characters in body
Jan 28, 2023 at 18:22 history answered Ismael Miguel CC BY-SA 4.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /