We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

how can make input non mandatory in sp modal

rishabh12
Tera Expert

I am building the similar functionality in todo's for approval requests. currently we have if click on reject it opens the below  pop-up

rishabh12_0-1700143693440.png
I want similar functionality for Approve Request also, when user click on approve request it should open popup, I am able to open the popup but I want if user doesn't enter comments while approving then also it should go ahead and approve the request but its not happening like that. 

rishabh12_1-1700143900159.png


I am using spmodal in client controller to achieve this:

spModal.open({
title:  c.data.CONST.i18n.APPROVE_MODAL_TITLE,
message:  c.data.CONST.i18n.APPROVE_MODAL_MESSAGE,
input: true,
 
buttons: [{
label: c.data.CONST.i18n.REJECT_MODAL_CANCEL,
cancel: true
},
{
label: c.data.CONST.i18n.APPROVE_MODAL_SUBMIT,
primary: false,
 
}
]
}).then(function(comments) {
 
if (c.data.esignRequiredObj.e_sign_required) {
openEsignatureModal(state, c.data.comments);
 
 
else {
alert("hi");
//sendUpdateRequest(state, c.data.CONST.ACTION, c.data.comments);
}
 
 
 
});

 

1 REPLY 1

AdusumalliK
Tera Contributor

Hi ,

 

Try using the below variable for answer:

const answer = spModal.open({
    title: title,
    label: title,
    message: message,
    input: {
        type: "text",
        value: comment,
        required: false // This makes the comment box non-mandatory
    },
    buttons: [{
            label: "${Cancel}",
            cancel: true
        },
        {
            label: primaryButtonLabel,
            primary: true
        }
    ]
});

 Please mark answer as Helpful if it works.