Fetching value from HTML part of widget to client or server side.

caas
Tera Expert

I have created a widgets which holds fields created by with html tag.(ex.  <input type="text" name="message" id="user_input">).

 

I would like to fetch the data entered in that field to my client or server side.

 

How can we do that?? Please suggest..

4 REPLIES 4

Ajaykumar1
Tera Guru

Hi Manoj

HTML:

<input type="text" name="message" id="user_input" ng-model = "c.message">

Client : //get value in client script

var message = c.message; // message will contain value entered in HTML form

 

//To call it on server side set c.data.message

c.data.message = c.message;

server : // get data on server side

input.message;

 

Mark if correct/helpful

Regards,
Ajay

 

Thanks for the solution but if we have multiple input tags then for each tag we have to specify ng-model??

Or is there any other way?

Kalaiarasan Pus
Giga Sage

This should answer your question as it is a hello world widget with text boxes - https://www.youtube.com/watch?v=3mvUTgomZPc

ScienceSoft
Tera Guru

Dear уmanojs749,
First thing first, you can fetch the info on the client side.
To do so, you can use following method:
declare a varibale, and use api
var variable = document.getElementById('sys_id_of_the_element');

variable.value would print the input in the field;
provide more details to get more definitive answer