Combining multiple fields for readonly title in the editor form

Combining multiple fields for readonly title in the editor form

JonathanTolhurstJonathanTolhurst Posts: 11Questions: 7Answers: 0

Is it possible to combine fields in a readonly part of the editor form?
E.g. I wanted to display "first_name last_name (extn)" at the top of the form as read only values with the rest of the fields editable below.
I have seen how you can use the read only display plugin (https://editor.datatables.net/plug-ins/field-type/editor.display) with only one field but was wondering how to do something similar with mutliple fields?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin
    Answer ✓

    Yes, you can use the fields.data method in much the same way as the DataTables columns.render method to manipulate the data. Using it as a function you have access to the full data object for the row and thus can return whatever you want based on that data. The only slightly more complicated factor with fields.data is you need to handle the set case, but if it is readonly you could simply do if ( type === 'set' ) { return; }.

    Allan

  • JonathanTolhurstJonathanTolhurst Posts: 11Questions: 7Answers: 0

    Thank You Allan - that's perfect :-)

This discussion has been closed.