How to get the value of select box in Client script from HTML and send that to Server script.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 09:06 AM
Hi,
I have a stuck in passing the value of html to client script and from there to server script.
This is my HTML:
<select id="options" ng-model="c.data.selectedValue" ng-change="c.getValue" for='selection'>
<option value="">Select Incident</option>
<option ng-repeat="incidict in data.inclists" ng-model="c.data.abc" value="{{incidict.number}}">{{incidict.number}}</option>
</select>
<select id="options" ng-model=c.child for='selection'>
<option value="">Select Incident</option>
<option ng-repeat="childict in data.childlists" value="{{childict.number}}">{{childict.number}}</option>
</select>
Client script
c.getValue= function(){
var testing = c.data.selectedValue;
alert(testing);
c.server.update();
}
Server script
var rec = new GlideRecord("incident");
rec.addEncodedQuery("active=true")
rec.query();
data.inclists=[];
var count=1;
while (rec.next()) {
var incidict = {};
incidict.no= count++;
incidict.sysid = rec.sys_id.toString();
incidict.number = rec.number.toString();
data.inclists.push(incidict);
}
var child = new GlideRecord("incident");
child.addEncodedQuery("parent_incident=" + "sysid of the parent incident which we will get from the first select box")
child.query();
data.childlists=[];
var counts=1;
while (rec.next()) {
var childict = {};
childict.no= counts++;
childict.sysid = rec.sys_id.toString();
childict.number = rec.number.toString();
data.childlists.push(childict);
}
Please help in this.
Thanks!
0 REPLIES 0