How to pass select box value to server script on button click - service portal

Bruler1230
Tera Expert

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

3 REPLIES 3

Pranav Bhagat
Kilo Sage

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

Thanks, how would this work along with an 'update' button click?

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