You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Juan Isern <ju...@gmail.com> on 2010/04/19 07:37:48 UTC

Problem with a form in a Block + AJAX

Hi guys, hope you're doing fine.

I was developing a component to load lazily content and I'm facing a
problem: forms seem to break when they're rendered from a Block to an AJAX
zone. 

They same problem occurs with ProgressiveDisplay. A very simple example that
shows the issue:

                               <t:progressivedisplay>
                                    <t:zone t:id="someZone">
                                        <t:form t:id="aForm"
t:zone="someZone">
                                            <t:submit/>
                                        </t:form>
                                    </t:zone>
                                </t:progressivedisplay>

When Submit is clicked, nothing happens. Doing a little research, I found
this JSON that results from the block rendering:

{"content":"<div class='t-zone' id='someZone-1281488a10e'><form
action='/sx/details.aform' method='post' id='aForm-1281488a10e'
name='aForm-1281488a10e'><div class='t-invisible'><input value='1437'
name='t:ac' type='hidden'><\/input><input
value='H4sIAAAAAAAAAFvzloG1XICBzyW1JDEzp9iquDQpN7OkuIjBIb8oXS+xIDE5I1WvJLEgtbikqNJULzm/KDUnMwlI5xbk56XmlRTrBYN1qAQU5SenFheDecXFmfl5zx4GfW12XfyCiYHRh4E7NSc1F6jcLzE3tYRByCcrsSxRPycxL10/uKQoMy/duqKghIENYjkAwXYdZJMAAAA='
name='t:formdata' type='hidden'><\/input><\/div><input name='submit'
type='submit'><\/input><\/form><\/div>","script":"Tapestry.init({\"linkZone\":[[\"aForm-1281488a10e\",\"someZone\",\"/sx/details.aform\"]],\"zone\":[\"someZone-1281488a10e\"]});\n"}

It seems that the problem lies in the fact that there's mismatch in the ids.
While Tap assigns its own id by appending some random characters at the end
of it, when registers a listener (I think...) it's using the ordinary
"someZone" id, that's making some Javascript break.

Do you guys have any clue about a possible workaround? It's driving me nuts!

Cheers!



-- 
View this message in context: http://old.nabble.com/Problem-with-a-form-in-a-Block-%2B-AJAX-tp28287358p28287358.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem with a form in a Block + AJAX

Posted by Juan Isern <ju...@gmail.com>.
After some hours of further testing, filed a JIRA issue that you can see at:

https://issues.apache.org/jira/browse/TAP5-1107

Best


Juan Isern wrote:
> 
> Hi guys, hope you're doing fine.
> 
> I was developing a component to load lazily content and I'm facing a
> problem: forms seem to break when they're rendered from a Block to an AJAX
> zone. 
> 
> They same problem occurs with ProgressiveDisplay. A very simple example
> that shows the issue:
> 
>                                <t:progressivedisplay>
>                                     <t:zone t:id="someZone">
>                                         <t:form t:id="aForm"
> t:zone="someZone">
>                                             <t:submit/>
>                                         </t:form>
>                                     </t:zone>
>                                 </t:progressivedisplay>
> 
> When Submit is clicked, nothing happens. Doing a little research, I found
> this JSON that results from the block rendering:
> 
> {"content":"<div class='t-zone' id='someZone-1281488a10e'><form
> action='/sx/details.aform' method='post' id='aForm-1281488a10e'
> name='aForm-1281488a10e'><div class='t-invisible'><input value='1437'
> name='t:ac' type='hidden'><\/input><input
> value='H4sIAAAAAAAAAFvzloG1XICBzyW1JDEzp9iquDQpN7OkuIjBIb8oXS+xIDE5I1WvJLEgtbikqNJULzm/KDUnMwlI5xbk56XmlRTrBYN1qAQU5SenFheDecXFmfl5zx4GfW12XfyCiYHRh4E7NSc1F6jcLzE3tYRByCcrsSxRPycxL10/uKQoMy/duqKghIENYjkAwXYdZJMAAAA='
> name='t:formdata' type='hidden'><\/input><\/div><input name='submit'
> type='submit'><\/input><\/form><\/div>","script":"Tapestry.init({\"linkZone\":[[\"aForm-1281488a10e\",\"someZone\",\"/sx/details.aform\"]],\"zone\":[\"someZone-1281488a10e\"]});\n"}
> 
> It seems that the problem lies in the fact that there's mismatch in the
> ids. While Tap assigns its own id by appending some random characters at
> the end of it, when registers a listener (I think...) it's using the
> ordinary "someZone" id, that's making some Javascript break.
> 
> Do you guys have any clue about a possible workaround? It's driving me
> nuts!
> 
> Cheers!
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-with-a-form-in-a-Block-%2B-AJAX-tp28287358p28287727.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem with a form in a Block + AJAX

Posted by Juan Isern <ju...@gmail.com>.
Thanks, it was much clearer when I saw t:id and id together.

Regards


Howard Lewis Ship wrote:
> 
> Bind the id parameter of the Zone explicitly. This is in the docs,
> please read them.
> 
> http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html
> 
> On Sun, Apr 18, 2010 at 10:37 PM, Juan Isern <ju...@gmail.com> wrote:
>>
>> Hi guys, hope you're doing fine.
>>
>> I was developing a component to load lazily content and I'm facing a
>> problem: forms seem to break when they're rendered from a Block to an
>> AJAX
>> zone.
>>
>> They same problem occurs with ProgressiveDisplay. A very simple example
>> that
>> shows the issue:
>>
>>                               <t:progressivedisplay>
>>                                    <t:zone t:id="someZone">
>>                                        <t:form t:id="aForm"
>> t:zone="someZone">
>>                                            <t:submit/>
>>                                        </t:form>
>>                                    </t:zone>
>>                                </t:progressivedisplay>
>>
>> When Submit is clicked, nothing happens. Doing a little research, I found
>> this JSON that results from the block rendering:
>>
>> {"content":"<div class='t-zone' id='someZone-1281488a10e'><form
>> action='/sx/details.aform' method='post' id='aForm-1281488a10e'
>> name='aForm-1281488a10e'><div class='t-invisible'><input value='1437'
>> name='t:ac' type='hidden'><\/input><input
>> value='H4sIAAAAAAAAAFvzloG1XICBzyW1JDEzp9iquDQpN7OkuIjBIb8oXS+xIDE5I1WvJLEgtbikqNJULzm/KDUnMwlI5xbk56XmlRTrBYN1qAQU5SenFheDecXFmfl5zx4GfW12XfyCiYHRh4E7NSc1F6jcLzE3tYRByCcrsSxRPycxL10/uKQoMy/duqKghIENYjkAwXYdZJMAAAA='
>> name='t:formdata' type='hidden'><\/input><\/div><input name='submit'
>> type='submit'><\/input><\/form><\/div>","script":"Tapestry.init({\"linkZone\":[[\"aForm-1281488a10e\",\"someZone\",\"/sx/details.aform\"]],\"zone\":[\"someZone-1281488a10e\"]});\n"}
>>
>> It seems that the problem lies in the fact that there's mismatch in the
>> ids.
>> While Tap assigns its own id by appending some random characters at the
>> end
>> of it, when registers a listener (I think...) it's using the ordinary
>> "someZone" id, that's making some Javascript break.
>>
>> Do you guys have any clue about a possible workaround? It's driving me
>> nuts!
>>
>> Cheers!
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Problem-with-a-form-in-a-Block-%2B-AJAX-tp28287358p28287358.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Problem-with-a-form-in-a-Block-%2B-AJAX-tp28287358p28323016.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Problem with a form in a Block + AJAX

Posted by Howard Lewis Ship <hl...@gmail.com>.
Bind the id parameter of the Zone explicitly. This is in the docs,
please read them.

http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Zone.html

On Sun, Apr 18, 2010 at 10:37 PM, Juan Isern <ju...@gmail.com> wrote:
>
> Hi guys, hope you're doing fine.
>
> I was developing a component to load lazily content and I'm facing a
> problem: forms seem to break when they're rendered from a Block to an AJAX
> zone.
>
> They same problem occurs with ProgressiveDisplay. A very simple example that
> shows the issue:
>
>                               <t:progressivedisplay>
>                                    <t:zone t:id="someZone">
>                                        <t:form t:id="aForm"
> t:zone="someZone">
>                                            <t:submit/>
>                                        </t:form>
>                                    </t:zone>
>                                </t:progressivedisplay>
>
> When Submit is clicked, nothing happens. Doing a little research, I found
> this JSON that results from the block rendering:
>
> {"content":"<div class='t-zone' id='someZone-1281488a10e'><form
> action='/sx/details.aform' method='post' id='aForm-1281488a10e'
> name='aForm-1281488a10e'><div class='t-invisible'><input value='1437'
> name='t:ac' type='hidden'><\/input><input
> value='H4sIAAAAAAAAAFvzloG1XICBzyW1JDEzp9iquDQpN7OkuIjBIb8oXS+xIDE5I1WvJLEgtbikqNJULzm/KDUnMwlI5xbk56XmlRTrBYN1qAQU5SenFheDecXFmfl5zx4GfW12XfyCiYHRh4E7NSc1F6jcLzE3tYRByCcrsSxRPycxL10/uKQoMy/duqKghIENYjkAwXYdZJMAAAA='
> name='t:formdata' type='hidden'><\/input><\/div><input name='submit'
> type='submit'><\/input><\/form><\/div>","script":"Tapestry.init({\"linkZone\":[[\"aForm-1281488a10e\",\"someZone\",\"/sx/details.aform\"]],\"zone\":[\"someZone-1281488a10e\"]});\n"}
>
> It seems that the problem lies in the fact that there's mismatch in the ids.
> While Tap assigns its own id by appending some random characters at the end
> of it, when registers a listener (I think...) it's using the ordinary
> "someZone" id, that's making some Javascript break.
>
> Do you guys have any clue about a possible workaround? It's driving me nuts!
>
> Cheers!
>
>
>
> --
> View this message in context: http://old.nabble.com/Problem-with-a-form-in-a-Block-%2B-AJAX-tp28287358p28287358.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org