ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Add new fields to the dialog on button click event


#1

Greetings, I currently need to add some new fields to a dialog if the user press the “Add Button”:

var dialog_loss = new frappe.ui.Dialog({
    title: "Insert the values",
        fields: [
            {
                 fieldname: "qty_loss_01", label: "Loss Qty",
                 fieldtype: "Data",
             },
             {
                 fieldname: "piece_loss_01", label: "Piece",
                 fieldtype: "Data",
             },
             {
                 fieldname: "btn_add", label: "Add",
                 fieldtype: "Button",
                 click: function(){
                     help_me_add_fields(xD)                       
                 }
              },

It’s basically the same fields that are there, but will be “qty_loss_02, qty_loss_03…” so on.

Any help would be greatly appreciated! Thank you for reading