# Removed form still in solutionModel

**URL:** <https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391>\
**Category:** Classic Servoy\
**Created:** [June 24, 2010, 1:50pm UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391 "2010-06-24T13:50:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [June 24, 2010, 1:50pm UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/1 "2010-06-24T13:50:56Z")

</div>

Hi,

I would like to know if the following is behavior like it should be.

I have a solution with 2 forms (firstForm and secondForm). the firstForm is the first form to show on startup solution.  
The secondForm is not shown. It is just designed.  
I decide to remove that second form, using the following coding:

```auto
	var _ok
	var _form = 'secondForm'
	
	//	Remove form from history
	_ok = history.removeForm(_form);
	if (! _ok)
		application.output('Error in remove history');
	
	//	Remove form from solution model
	_ok = solutionModel.removeForm(_form);
	if (! _ok)
		application.output('Error in remove solution model');
	
	var _jsForm = solutionModel.getForm(_form)
	if (_jsForm == null)
		application.output('Form not found, like expected')
	else
		application.output('Formobject returned, unwanted');

```

When running my solution, I get message “Formobject returned, unwanted”. That is not what I expected, because I removed the form from the solutionModel.  
When I run the coding twice, then I get:

Error in remove history  
Error in remove solution model  
Formobject returned, unwanted

The errormessages seem to be logic, because I removed the form from the solutionModel.

Is there something missing, or is this a bug (Servoy 5.1.4)

Martin

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [June 24, 2010, 3:15pm UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/2 "2010-06-24T15:15:13Z")

</div>

I think it is a bug.

When I show all forms as out using forms.allnames  
then this situation seems only to occur on the last formname in the array

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [June 25, 2010, 9:09am UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/3 "2010-06-25T09:09:59Z")

</div>

Martin,

solutionModel.removeForm(\_form) will revert the form to the state as it was in the original solution (before any solution model actions).  
So a new form will be deleted, but a form that exists in the designed solution will be reverted.

Rob

\*\* edit \*\*  
I was wrong in this, solution.revertForm() should do this, solutionModel.removeForm() should remove a form, even if it is was in the original design-time solution.

Rob

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 6, 2010, 8:28am UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/4 "2010-07-06T08:28:23Z")

</div>

this is a bug yes if a changed designed solution isn’t removed  
I looked at the code and it should remove it (hide it) completely. But there could be a bug because it is changed first.

The thing i ask is why do you want to remove a designed form anyway? What do you want to achieve?  
It is not memory usage that you gain, because a designed form is not really gone it is just hidden.  
Do you want to create another form that has the same name? So that you completely replace it?

---

<div class="post-metadata">

**Author:** ![martinh](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@martinh](https://forum.servoy.com/u/martinh)\
**Post date:** [July 6, 2010, 8:35am UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/5 "2010-07-06T08:35:02Z")

</div>

> jcompagner:  
> Do you want to create another form that has the same name? So that you completely replace it?

Yes that was the situation, but I made a workaround for that.

I had forms that were designed and those forms need to be generated now using the SM.  
But because I didn’t want to remove the original forms yet, I thought I could solve it like this.  
And it worked, except some form(s).  
And I saw it went wrong on the form(s) that was the shown last when I print forms.allnames

But as I said, I made a workaround and don’t have the problem anymore

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 7, 2010, 12:41pm UTC](https://forum.servoy.com/t/removed-form-still-in-solutionmodel/12391/6 "2010-07-07T12:41:58Z")

</div>

i did fix this problem, it was only reproducible if you altered a module form and wanted to remove that.
