I have a form based on a custom dataSource; it has to be rebuild at load time and then at runtime (destroyed and then recreated with the same form name).
At loadtime it works just fine but then when I try to run the same code it does not work. history.removeForm(_formName) returns false.
The code is simple
forms.someOtherForm.controller.show();
var success = history.removeForm(_formName);
//removes the named form from this session, please make sure you called history.remove() first
if(success)
{
solutionModel.removeForm(_formName)
}
What could be a reason for not being able to remove a form from history?
pbakker:
Or if the form is visible to the user it will not work. You need to remove the form form the UI first.
Do you mean remove the form from the UI by showing some other form? That’s what I do before trying to remove the form from history: forms.someOtherForm.controller.show()
Or did you mean anything else?
All code to remove and re-create the form is in another form.
There are no global vars that reference the form.
The same code runs just fine if called in onLoad method of the form.
There must be something else going wrong.
I seem to have found the reason.
The code was running while a modal window was open, so the show() method was working in the modal window, not in the main.
While in the main window the form that I wanted to remove from history still remained showing.
Closing the modal window before manipulating the form solved the problem.