TabPanel add Solutionmodel Form

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

TabPanel add Solutionmodel Form

Postby Janssenjos » Wed Mar 24, 2010 4:21 pm

Hi all,

Having troubles to add a form, created with the solutionmodel, to an existing tabpanel. I keep getting false from the addTab method :evil:

Hope someone can tell me what I'm doing wrong:
Code: Select all
//Clear current forms from tab   
elements.tabParams.removeAllTabs();

var _formName = "paramForm";
var _form= solutionModel.getForm(_formName) ;

//If the form doesn't exist yet, create form
if(_form  == null)
{      
   _form = solutionModel.newForm(_formName,"data",[],'Default',false,450,280);
   
   //Get foundset of all parameters for this step   
   var paramFoundset = databaseManager.getFoundSet("data","Steps");

   if(paramFoundset.find())
   {
      paramFoundset.StepId= localStepId;
      paramFoundset.search();         
   }

   //Now create a textbox for each step.
   for(var i = 1; i <= paramFoundset.getSize();i++)
   {
      var _param = paramFoundset.getRecord(i);         
         
      var jsvar = _form.newFormVariable("param_"+_param.id,JSVariable.TEXT);
      var lb = _form.newLabel(_param.name,15,i*25,80,20);
      var tf = _form.newTextField("param_"+_param.id ,15,i*25,140,20);
   }      
}   

//Add the form to the tabpanel
//Success is false everytime.
var success = elements.tabParams.addTab(_form, 'Test', null, null, null, null, null);
   
application.output('Form successfully added to the tab: ' + success);


Thanks.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: TabPanel add Solutionmodel Form

Postby pbakker » Wed Mar 24, 2010 4:32 pm

Code: Select all
var success = elements.tabParams.addTab(_form, 'Test', null, null, null, null, null);


The _form variable in the above code snipplet is a JSForm, so a solutionModel representation of a form, not the runtime representation of the form. Try adding forms[_formName]

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: TabPanel add Solutionmodel Form

Postby Janssenjos » Wed Mar 24, 2010 4:41 pm

Thanks!

That was the problem :D
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom


Return to Web Development

Who is online

Users browsing this forum: No registered users and 2 guests

cron