Need to provide pop-up to user to enter text when they click on UI action

Mounika M
Tera Contributor

HI All,
I have requirement that when an user click on UI action one pop-up will show and user has to enter input and that will copy over the work notes, i have tried below code but it is not working, can anyone please help on this.

UI action:

var rejectConfirmDialog;

function loadConfirmDialog() {
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
rejectConfirmDialog = new dialogClass("incident_confirm_cancel", false, 648, 250);
rejectConfirmDialog.setTitle(new GwtMessage().getMessage("Reason"));
rejectConfirmDialog.render();
}

function moveToCancel(notes) {
//g_form.setValue("state", 7);
g_form.setValue("work_notes", notes);
rejectConfirmDialog.destroy();
gsftSubmit(null, g_form.getFormElement(), "cancel_inc");

}

if (typeof window == 'undefined')
setRedirect();

function setRedirect() {
current.update();
action.setRedirectURL(current);
}
UI Page
HTML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:dialog_notes_ok_cancel
dialog_id="incident_confirm_cancel"
textarea_id="incident_confirm_reason_text"
textarea_label="${gs.getMessage('Reason')}"
textarea_label_title="${gs.getMessage('A reason is required to cancel this incident')}"
textarea_name="incident_confirm_reason_text"
textarea_onkeyup="enableButton()"
textarea_onchange="enableButton()"
textarea_style="height:auto; width: 100%; resize: vertical;"
textarea_title="${gs.getMessage('Enter the reason here')}"
ok=""
ok_action="cancelincident"
ok_id="incident"
ok_title="${gs.getMessage('Cancel incident')}"
ok_type="button"
ok_style_class="btn btn-primary disabled"
incident_title="${gs.getMessage('Close the dialog')}"
/>
</j:jelly>
Client script :
function cancelincident() {
var textArea = $("incident_confirm_reason_text");
if (textArea)
moveToCancel(textArea.value.trim());
}

(function() {
$("incident_confirm_reason_text").focus();
})();
 
Thanks in Advance!


0 REPLIES 0