Filling in the value of field based on another field using dependent() and momentjs.

Filling in the value of field based on another field using dependent() and momentjs.

huba_sbfhuba_sbf Posts: 16Questions: 6Answers: 1

Hello,

I am trying to automatically set a value for "field2" when editing the value of "field1".
The code below is supposed to auto fill the value of "field2" with the value given to "field1". And it actually works!

editor.dependent( 'field1', function ( val ) {
        if (val != '') {
                 editor.field( 'field2').val(val);
        }
});

However it does nothing when using the timepicker I have found in this example: https://editor.datatables.net/examples/dates/time.
Any thoughts? Thanks a lot.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin

    That does indeed appear to be a bug. Let me look into it and I'll get back to you.

    Regards,
    Allan

  • huba_sbfhuba_sbf Posts: 16Questions: 6Answers: 1

    OK, thank you very much, looking forward to it.

  • huba_sbfhuba_sbf Posts: 16Questions: 6Answers: 1
    edited October 2016

    Any news regarding this issue or an ETA or why not, some workaround?
    Thank you Allan.

  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin

    I've afraid I've not had a chance to look into this in the last two days. I'll post back here as soon as I have done.

    Allan

  • huba_sbfhuba_sbf Posts: 16Questions: 6Answers: 1

    OK, thank you very much!

  • allanallan Posts: 63,195Questions: 1Answers: 10,412 Site admin
    Answer ✓

    Hi,

    Little update - this is indeed a bug in the shipping version of Editor. I've committed a fix for the next version. Until then, there is a workaround available in this thread.

    Regards,
    Allan

This discussion has been closed.