gel is not working in ui page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 04:34 AM
I have created a UI page with textarea amd in client script I have written that when text area is empty it should show an alert box.But even text area is empty it is returning true.Help me on this?
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:ui_form>
<div class="row">
<div >
<span style="padding:16px;font-weight:bold;">What were you attempting to do when the performance issue occurred?</span>
</div>
</div>
<div class="row">
<div class="form-horizontal">
<div class="form-group" style="margin-left:16px !important;margin-right:16px !important">
<textarea id="comments" name="comments"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<span class="pull-right">
<button class="btn btn-primary" id="ok_button" onclick="actionOK()" style="min-width: 5em;" title="" type="submit">
Send Email
</button>
</span>
</div>
<input type="hidden" id="kbSysID" name="kbSysID" value="${sysparm_sysID}"/>
</g:ui_form>
</j:jelly>
clientscript:
function actionOK() {
alert("entered");
var value = gel('comments').value;
alert(value);
if (value != '') {
alert("comments filled");
return true;
} else {
alert("please fill");
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 05:14 AM
i tested your script. its working. i can see alert is coming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 05:32 AM
Alerts are working fine but even the textarea is empty, it is showing an alert saying "comments are filled"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 05:33 AM
no it is not. if its empty i am getting only else part of alert ( alert("please fill") );
.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 05:34 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 05:36 AM
your script
<?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:ui_form>
<div class="row">
<div >
<span style="padding:16px;font-weight:bold;">What were you attempting to do when the performance issue occurred?</span>
</div>
</div>
<div class="row">
<div class="form-horizontal">
<div class="form-group" style="margin-left:16px !important;margin-right:16px !important">
<textarea id="comments" name="comments"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<span class="pull-right">
<button class="btn btn-primary" id="ok_button" onclick="actionOK()" style="min-width: 5em;" title="" type="submit">
Send Email
</button>
</span>
</div>
<input type="hidden" id="kbSysID" name="kbSysID" value="${sysparm_sysID}"/>
</g:ui_form>
</j:jelly>
function actionOK() {
// alert("entered");
var value = gel('comments').value;
// alert(value);
if (value != '') {
alert("comments filled");
return true;
} else {
alert("please fill");
return false;
}
}