How to pass select box value to server script on button click - service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 07:57 AM
Hello,
I have a service portal widget that contains a select box with populated values. I have an 'update' button that should take the value that is currently in the select box and pass that to the server script that has a function that will update the record with that value. What i am trying to figure out is how do i get the value that is in the select box and pass that to the server script when the update button is clicked? Let me know if more info is needed. thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 08:02 AM
Basically you have to use ng-model on the checkbox input type then when you update the server using c.server.update ,you get a input object available in server and you can get the current value of that input type.
HTML
<input type="checkbox" name="checkboxx" id="checkbox" ng-model="data.shipchk"></td>
Client script
c.server.update().then(function(){
})
Server Side
U can use it anywhere in server side.
if(input){
input.shipchk
}
Regards
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 08:37 AM
Thanks, how would this work along with an 'update' button click?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 09:05 AM
This example might help you.
HTML
<button ng-click='c.update1()'>Update</button>
<input type="checkbox" name="checkboxx" id="checkbox" ng-model="data.shipchk"></td>
Client script
c.update = function(){
c.server.update().then(function(){
})
}
Server Side
U can use it anywhere in server side.
if(input){
var k = input.shipchk;
console.log(k);
}
Regards
Pranav