Default value to a Datatable editor field, from a javascript function

Default value to a Datatable editor field, from a javascript function

jalapejalape Posts: 117Questions: 2Answers: 1

Hello,
I want to pass a default value to a Datatable editor field, from a javascript function that generates a random code.

function makeid(length) {
   var result           = '';
   var characters       = 'abcdefghijklmnopqrstuvwxyz0123456789';
   var charactersLength = characters.length;
   for ( var i = 0; i < length; i++ ) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
   }
   return result;

}

I don't know how the function is referenced in the edit form field.

            {
                label: "code:",
                name:  "sml_maps.code",
                default: ''
            },

Thanks

Replies

This discussion has been closed.