Assign to variable name a value

Questions and answers for designing and implementing forms in Servoy

Assign to variable name a value

Postby leonid » Mon Sep 17, 2012 7:24 pm

Hi,
I use as a dataprovider in TEXT_FIELD a form variable . After some procedures I want set my providers to default values. For this purpose I use general procedure where I define all my variables in form and assign to it defaultValue :

var frm_vars = myForm.getFormVariables();
for (var i =0; i< frm_vars.length; i++) {
var frm_var = frm_vars[i];
tcontroller.setDataProviderValue(frm_var.name,frm_var.defaultValue);

When my form loaded first time all my text fields are empty, but when I reset my variables the default values appears in my Text_Fields: if my default value was null it show null in text_field , or if type of variable was string it will show double quote..
How to exclude it ?
Leonid,
Servoy / Foxpro / Java
leonid
 
Posts: 34
Joined: Wed Aug 29, 2012 1:58 am

Re: Assign to variable name a value

Postby omar » Tue Sep 18, 2012 10:54 am

Hi Leronid,

Normally, you would define a form variable, assign it a default value at declaration and bind it to the field. That's all. But I guess you want to be able to initialize your default values at runtime depending on a specific situation? If so, in which event do you set the form variables?
Intrasoft, Founder
Omar van Galen
omar@intrasoft.nl
+31-(0)6-21234586
Servoy Developer
omar
 
Posts: 377
Joined: Sat Feb 12, 2011 4:51 pm
Location: Intrasoft, The Netherlands

Re: Assign to variable name a value

Postby leonid » Tue Sep 18, 2012 1:22 pm

Hi Omar
Yes, I created form variables and bind them with my Text_Field controls. On My form I have add button which handle by onAction event. After updating database I call my Global Function Reset Variables to clear my Text_Fields controls.
Also I call same Reset Method onShow form . From OnShow event I don't have same problem when form Loaded.
Leonid,
Servoy / Foxpro / Java
leonid
 
Posts: 34
Joined: Wed Aug 29, 2012 1:58 am


Return to Forms

Who is online

Users browsing this forum: Google [Bot] and 3 guests