Best way to remove certain values from a cloned record

Best way to remove certain values from a cloned record

gehornegehorne Posts: 10Questions: 2Answers: 1

Was able to add a button to clone a record using the datatables example

https://editor.datatables.net/examples/api/duplicateButton.html

In my application I would like to change certain values to null to force the user to enter certain fields after the record is cloned. Any suggestions?

GEH

This question has an accepted answers - jump to answer

Answers

  • gehornegehorne Posts: 10Questions: 2Answers: 1

    Was able to set the value of the field using the field name.

    Modified the sample new entry to read in my case:

    editor
    .create( {
    title: 'Clone an existing record' ,
    buttons: 'Create from existing'
    } )
    .set( values )
    .field ( 'chemical_inv.ppe_requirements' ).val ( '' );

    Thanks much, great product.

  • allanallan Posts: 61,848Questions: 1Answers: 10,134 Site admin
    Answer ✓

    Hi,

    That looks like it is probably the best way to me. The other option would be to remove the chemical_inv.ppe_requirements from the values object by deleting it before calling set():

    delete values[ 'chemical_inv.ppe_requirements' ];
    

    Allan

This discussion has been closed.