# Solution Model field not showing value

**URL:** <https://forum.servoy.com/t/solution-model-field-not-showing-value/17329>\
**Category:** Classic Servoy\
**Created:** [July 8, 2013, 5:04pm UTC](https://forum.servoy.com/t/solution-model-field-not-showing-value/17329 "2013-07-08T17:04:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)\
**Post date:** [July 8, 2013, 5:04pm UTC](https://forum.servoy.com/t/solution-model-field-not-showing-value/17329/1 "2013-07-08T17:04:15Z")

</div>

I have a solution model form with some fields showing only if a checkbox is selected. Selecting the checkbox fires a solution model method. The dataprovider of the field is a variable containing values that I would like to be able to modify in certain circumstances. The problem is that the field never shows the expected value, but it is empty. I am sure, however, that the associated dataprovider variable contains the correct value.

```auto
var fldNo = (a number)
var chkMod = (a checkbox field)
for(var i = 0; i < fldNo; i++)
{
solutionModel.newGlobalVariable('globals','gb_vr_modVal' + i,JSVariable.TEXT);
scopes.globals['gb_vr_modVal' + i] = 'new' + i;
var modValFld = frmCsv.newField(scopes.globals['gb_vr_modVal' + i],JSField.TEXT_FIELD,chkMod.x + 20 + 10,chkMod.y,280,20);
modValFld.name = 'modValFld' + i;
modValFld.visible = false;
modValFld.transparent = false;
}
var chkMeth = "function chkModMeth(oldValue,newValue,event) { if(newValue == 1) { forms['frmCsv']elements['modValFld' + event.getElementName().substring(6)].visible = true; } } 
chkMod.onDataChange = chkMeth;

```

I tried to change the value of the field dataprovider after making it visible, but same result. And if I do a recreateUI() the field disappear.

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [July 10, 2013, 10:35am UTC](https://forum.servoy.com/t/solution-model-field-not-showing-value/17329/2 "2013-07-10T10:35:39Z")

</div>

I see two problems in there after a quick look:

- The dataprovider you specify for the new field is wrong. Try to think ‘form designer’ like when using solutionModel. You don’t set the dataprovider’s value in there but it’s name. Try this instead:

```auto
var modValFld = frmCsv.newField('scopes.globals.gb_vr_modVal' + i,JSField.TEXT_FIELD,chkMod.x + 20 + 10,chkMod.y,280,20);

```

- If chkMod is a JSField, you should use a JSMethod for setting onDataChange. See solutionModel.newGlobalMethod(…) or jsForm.newMethod(…)

---

<div class="post-metadata">

**Author:** ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)\
**Post date:** [July 10, 2013, 10:57am UTC](https://forum.servoy.com/t/solution-model-field-not-showing-value/17329/3 "2013-07-10T10:57:27Z")

</div>

> Andrei Costescu:  
> I see two problems in there after a quick look:  
> … You don’t set the dataprovider’s value in there but it’s name. …

Many thanks. That solved the problem.
