Hello,
I'm building a page that has a form for creating a mapper as well as a list of all existing entries for that mapper. The list has an edit link for each mapper that is created via SHtml.a, which calls a JsCmd that appends an edit form for that entry to the page in a modal window. The edit form and the creation form are built by the same rendering/processing method defined in the singleton of the mapper (it takes a Box[Mapper] argument and runs creation logic if the argument is empty, or edits the passed mapper entry otherwise). This method is first called to construct the creation form. When the edit link is clicked, it is called again, but this time the method is passed the mapper instance to edit. When the edit form is rendered, it successfully loads the values for the existing mapper entry passed to it. But when the ajax submit button is clicked, it uses the callback logic for the creation form. I'm guessing this has to do with reflection snippets being instantiated once per http request, for which the solution seems to be DispatchSnippets, but I'm not sure how to use a DispatchSnippet in this situation, especially given that the method is defined in a Mapper, then called later in a snippet.
Is there an example of DispatchSnippets being used to use a snippet twice on the same page? Sorry for not posting any code but it's big and convoluted. Any advice would be greatly appreciated.
Thanks,
Adam