SolutionModel question

Hi,

I would like to add afield to an existing form, but nothing happens.

var myForm = solutionModel.getForm('calendar')
	myForm.newLabel('Country', 20, 86, 80, 20) 
	myForm.newTextField('field1', 140, 70, 141, 111)
	forms.calendar.controller.show()

Do I miss something? If I do the same on a new form it woks.

Hi Irene,

When you have an already loaded (or existing form) you need to ‘remove’ it from the model and the history like so:

// put the form in a variable
var myForm = solutionModel.getForm('calendar');

// remove the form from the solutionModel and history
history.removeForm('calendar');
solutionModel.removeForm('calendar');

// Change the form
myForm.newLabel('Country', 20, 86, 80, 20);
myForm.newTextField('field1', 140, 70, 141, 111);

// Now recreate the form again and show it
forms.calendar.controller.show()

Hope this helps.

Hi Robert,

I tried. To remove the history it’s enough. I don’t need to remove the form.
I’m glad that I don’t have to rebuild the whole form each time.

Thanks for your help.