Retrieving NEW values from the form

function create_file(){
head:{ view:“toolbar”,
data:[{type:“label”, label:“Create new file”, align:“center”}]
{ view:“form”,
{type:“text”,id:“noc”,label:“No of columns”,labelWidth:150,inputWidth:150,width:300}

Now what happens is that the old value of filename gets passed to the function even when I change it in the form after running. I kept the value attribute as blank. And then gave the value after running, that time blank value is passed. I wanted to know how to pass the new value entered by the user.
Please help

The correct approach is:


function add_col_details(){
var value = $$(‘form1’).item(‘filename’).value;
/other code here/

Still the blank values are getting retrieved. In that ‘value’ variable blank value is getting stored.
User entered values are not getting retrieved.

Sorry, that method can not be applied to form. Try the following approach:

var value = $$(‘form1’).getValues().filename;

getValues() method returns all values.

Or else If I write value=‘abc’ attribute then the same value gets retrieved even if user modifies that value in the textbox in the form.
Please help.
Thank you.

Sorry for the above reply. Didn’t realise you had replied.
Thanks a lot. getValues() method worked. Actually I had tried that method but used getValues(id) instead of getValues().id
Thanks a lot.

Now suppose the situation is like I have ‘id’ stored in a variable.
var userid=“id1”;

And then if I give
it doesn’t work.

The problem is that, I have used the above statement in a for loop. And hence the id is dependent on the looping variable i.
So I used
var userid=“id”+i;

That doesn’t work. I cannot put
It again doesn’t work.

How to proceed ?
Please help.

getValues returns hash of values. Therefore, you may use the following:

var userid=“id1”;

var values = $$(‘form2’).getValues();
var user = values[userid];

Thanks again.