htmlString += " <button type=\"button\" class=\"btn-link border-0 cancel-btn-v1\" data-bs-toggle=\"modal\" data-bs-target=\"#cancelSubscription_" + rowInd + "\" onclick=\"openModalPauseAtClickCoordinate(this)\">" + TITLES.BUTTONS.CANCEL_SUBSCRIPTION + "</button>";
htmlString += "<a href=\"javascript:void(0);\" class=\"btn btn-primary btn-sm\" onclick=\"var data = {};data.unsubscribe = 'T';var value = JSON.stringify(data); nlapiSetFieldValue('custpage_newfield', value); document.getElementById('main_form').submit();\">" + TITLES.BUTTONS.SUBMIT + "</a>";
How can I combine this both button into one.
By adding both the modal opening and form submission into the onclick event of your button: