3

I have looked in the /media/system/js/repeatable-uncompressed.js file but could only find events that trigger after the init of JRepeatable.

Is there a way to update the input value of the repeatable field, and then initialize a new draw or build of the repeatable fields based on the new values.

To update the value of the repeatable field is easy:

var fer = '{"key":["1","38","3","13","23"],"cpe":["3","2","3","3","2"],"mbr":["3","2","3","3","2"],"mtr":["3","2","3","2","2"]}';
jQuery('#jform_repeatable_id').val(fer);

But to get it to initialize based on those new values is what I need.

1

By default Repeatable initialised on load event, so you have time to change the value on ready event, that occurs before load event.

jQuery(document).ready(function(){
  jQuery('#jform_repeatable_id').val('json string of your new value');
})
  • I need to change the values some time later when the user clicks on another field. – Llewellyn Sep 7 '15 at 10:03
  • hm, unfortunately I do not see a way to do this .. you still can set jQuery('#jform_repeatable_id').val('json string of your new value') but it will not affect existing instance, and can be reseted ... – Fedik Sep 7 '15 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.