[Seaside] Form extended with ajax and callbacks
norbert at hartl.name
Fri Dec 2 17:21:14 UTC 2011
Am 02.12.2011 um 17:45 schrieb Norbert Hartl:
> Am 02.12.2011 um 17:25 schrieb Paul DeBruicker:
>> On 11-12-02 07:57 AM, Norbert Hartl wrote:
>>> I'm asking myself if I do something wrong or if it is not supported in seaside. I have a form that is rendered the first time. The form includes a select that when being changed triggers an ajax call and this inserts a new input field inside the form. Should it work that I get a value from the input field when the form is being submitted?
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>> I would have guessed that would work. Is it a textInput or something that requires you to serializeWithHidden? Does your input have a 'name' property after its inserted? Does the input's id or name conflict with anything else in the page/form? Can you see in Firebug if the parameter is sent back to Seaside? Why not just show/hide the textInput? Are you submitting the form with ajax or in the traditional way?
> it is a text input field . It has name property and it is transferred to the server. I cannot see anything the input field conflicts with. I don't use toggle because I don't know upfront what has to be inserted. The select field selects a class that is transferred to the server. There a new instance is created and it is returned as magritte component. So I need the extra roundtrip.
Ok, I've found the problem. As it is all the same form I submit it twice. Once for the transfer of the select value and the second time when using the submit button. The select callback is triggered a second time and the magritte component gets resetted and that is the reason I can't see the value. I'm not sure what is the best solution to it. Is it possible to submit only a subset of the form fields? Otherwise I need to detect this case somehow.
More information about the seaside