I have several partial pages that contain popup dialogs. The first time the page loads everything is fine, but after loading other pages and returning to one with a dialog I get a script error when Webmaker tries to re-register the dialog such as:
Error: Tried to register widget with id==popup_WasteGen_group but that id is already registered
This error interrupts the onload scripts and my page does not perform correctly.
Is there any condition I can put on the call to "require" that is needed in the onbeforeload event so that this error doesn't occur?
This is occurring with WM5.
Error: Tried to register widget with id==popup_WasteGen_group but that id is already registered
This error interrupts the onload scripts and my page does not perform correctly.
Is there any condition I can put on the call to "require" that is needed in the onbeforeload event so that this error doesn't occur?
This is occurring with WM5.
RE: Error re-loading partial page due to popup dialog
That error occurs when it tries to initialise a new widget (eg the dialog) when it thinks one already exists on the page with the same id.
When you load a partial page into a group, WebMaker will first remove any widgets already present in that group before loading in and initialising the new content. This should mean that you can reload the partial page into the group again without any issues.
Where you might have issues is if you have multiple different partial pages with the same named widget that are loaded into one main page at the same time. In this case you will need to rename the controls on each partial page to have unique names.
Alternatively you will have problems if trying to load the same partial page into multiple locations on one full page at the same time. This situation is much harder to resolve as you can+?+?+?t just rename the controls to make them unique. One possible option might be to put a conditional +?+?++Remove based on server data+?+?+? check around the dialog widget group to only output it for the first location where the partial page is displayed?
Do either of these scenarios seem similar to what you are trying to do, and so could be the cause of the error?
If we can track down the scenario that is causing the error we can then determine the best solution to resolve it.
Regards,
Gerard
RE: Error re-loading partial page due to popup dialog
Unfortunately, the dialog in question (actually it happens with all of them) already has a unique name. Also, only one page is loaded at a time. The nature of the project is that a very large form was broken up into multiple logical pages. Each page is loaded in turn into a partial page container in the main form and data is saved as the page changes. Some of the pages have dialog objects for the maintenance of tabular data. The user may move arbitrarily to any page by clicking on a navigation bar at the top of the main form. If I navigate to page 7 (for example), the first visit works fine, but if I change to another page and then come back, the error occurs.
I can attach the offending project if it helps...
RE: Error re-loading partial page due to popup dialog
Thanks for the extra information.
It you are able to provide a project to look through that would be very useful.
Form what you are describing I don+?+?+?t think you should have any issues as only one of the partial pages is shown at a time.
It seems like the widgets are not being cleared up correctly as you switch between the different partial pages. Being able to look through the project will make it much easier to try and find out why this is the case.
Regards,
Gerard
RE: Error re-loading partial page due to popup dialog
RE: Error re-loading partial page due to popup dialog
Thanks for providing your project.
I have had a look at this, and have been able to replicate the problem you are seeing.
This is occurring because the dialog widgets get moved out of their original location when they are initialised so that they can correctly appear over the top of all the other content.
As a result of this they are not getting correctly destroyed later with all the other widgets.
I have attached a new script file that you should be able to use to resolve this problem. This attaches to the existing functions, and makes sure that the dialog widgets also get destroyed when needed.
To use this fix please rename the attached file to +?+?++DialogWidgetFix.js+?+?+? and then add this new script as an application wide file for your project. If you now save the Application Map, you should find that the problem is resolved when you next Run Test or Publish.
Note: The 5.0.0.0002 patch for WebMaker 5 and all later versions already include a fix for this problem. This script file should NOT be used with these versions, as it may cause issues with the dialog display.
I hope this helps. Please let me know if you have any further questions.
Regards,
Gerard
RE: Error re-loading partial page due to popup dialog