You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stefan <st...@wammel.com> on 2009/10/01 09:34:54 UTC

Issues with AjaxFormloop and addRowLink

Hi,

is it possible to block adding further rows to an AjaxFormloop?
Inside my addRow method i check some things and in some cases I don't  
want to add further rows.
In these cases i return a FALSE (tried NULL also), but the last row  
will be appended twice (or more times).

What's going wrong here?

Thanks,
Stefan

Re: Issues with AjaxFormloop and addRowLink

Posted by cordenier christophe <ch...@gmail.com>.
Why not also use your condition 't:if' in the body of the AjaxFormLoop...

2009/10/1 cordenier christophe <ch...@gmail.com>

> Actually, i had a closer look to AjaxFormLoop. Here the Javascript that
> launches trigger the start for add row event :
>
>     ajaxFormLoop : function(spec)
>     {
>         var rowInjector = $(spec.rowInjector);
>
>         $(spec.addRowTriggers).each(function(triggerId)
>         {
>             $(triggerId).observe("click", function(event)
>             {
>                 $(rowInjector).trigger();
>
>                 Event.stop(event);
>             })
>         });
>     }
>
> Maybe you can override this method to add an Ajax call (event link) before
> ' $(rowInjector).trigger();' to call a method that verify if the trigger
> method must be called.
>
> I'm not sure this is the easiest way :)
>
>
>
> 2009/10/1 Stefan <st...@wammel.com>
>
>> Here's what i've tried, but it won't work as expected.It works only after
>> a page reload or a reload of the whole formloop.
>>
>> Define your own AddRowLink that checks a condition before
>> launching the AddRow Event...
>>
>> How can i check conditions *before* triggering the event?
>>
>> <t:parameter name="addRow" >
>>  <td colspan="5" style="text-align: right">
>>  <t:if test="addRowEnabled" t:zone="formLoopZone">
>>  <t:addrowlink>${message:addRow}</t:addrowlink>
>>  <p:else>
>>  ${message:maximumRowsReached}
>> </p:else>
>>  </t:if>
>>  </td>
>> </t:parameter>
>>
>>
>> Am 01.10.2009 um 09:53 schrieb cordenier christophe:
>>
>> Hi
>>
>> Maybe you can achieve this by setting the addRow parameter on the
>> AjaxFormLoop. Define your own AddRowLink that checks a condition before
>> launching the AddRow Event...
>>
>> 2009/10/1 Stefan <st...@wammel.com>
>>
>> Hi,
>>
>>
>> is it possible to block adding further rows to an AjaxFormloop?
>>
>> Inside my addRow method i check some things and in some cases I don't want
>>
>> to add further rows.
>>
>> In these cases i return a FALSE (tried NULL also), but the last row will
>> be
>>
>> appended twice (or more times).
>>
>>
>> What's going wrong here?
>>
>>
>> Thanks,
>>
>> Stefan
>>
>>
>>
>

Re: Issues with AjaxFormloop and addRowLink

Posted by cordenier christophe <ch...@gmail.com>.
Actually, i had a closer look to AjaxFormLoop. Here the Javascript that
launches trigger the start for add row event :

    ajaxFormLoop : function(spec)
    {
        var rowInjector = $(spec.rowInjector);

        $(spec.addRowTriggers).each(function(triggerId)
        {
            $(triggerId).observe("click", function(event)
            {
                $(rowInjector).trigger();

                Event.stop(event);
            })
        });
    }

Maybe you can override this method to add an Ajax call (event link) before '
$(rowInjector).trigger();' to call a method that verify if the trigger
method must be called.

I'm not sure this is the easiest way :)


2009/10/1 Stefan <st...@wammel.com>

> Here's what i've tried, but it won't work as expected.It works only after
> a page reload or a reload of the whole formloop.
>
> Define your own AddRowLink that checks a condition before
> launching the AddRow Event...
>
> How can i check conditions *before* triggering the event?
>
> <t:parameter name="addRow" >
> <td colspan="5" style="text-align: right">
>  <t:if test="addRowEnabled" t:zone="formLoopZone">
>  <t:addrowlink>${message:addRow}</t:addrowlink>
> <p:else>
> ${message:maximumRowsReached}
> </p:else>
> </t:if>
> </td>
> </t:parameter>
>
>
> Am 01.10.2009 um 09:53 schrieb cordenier christophe:
>
> Hi
>
> Maybe you can achieve this by setting the addRow parameter on the
> AjaxFormLoop. Define your own AddRowLink that checks a condition before
> launching the AddRow Event...
>
> 2009/10/1 Stefan <st...@wammel.com>
>
> Hi,
>
>
> is it possible to block adding further rows to an AjaxFormloop?
>
> Inside my addRow method i check some things and in some cases I don't want
>
> to add further rows.
>
> In these cases i return a FALSE (tried NULL also), but the last row will be
>
> appended twice (or more times).
>
>
> What's going wrong here?
>
>
> Thanks,
>
> Stefan
>
>
>

Re: Issues with AjaxFormloop and addRowLink

Posted by Stefan <st...@wammel.com>.
Here's what i've tried, but it won't work as expected.
It works only after a page reload or a reload of the whole formloop.

> Define your own AddRowLink that checks a condition before
> launching the AddRow Event...
How can i check conditions *before* triggering the event?

<t:parameter name="addRow" >
	<td colspan="5" style="text-align: right">
		<t:if test="addRowEnabled" t:zone="formLoopZone">
			<t:addrowlink>${message:addRow}</t:addrowlink>
			<p:else>
				${message:maximumRowsReached}
			</p:else>
		</t:if>
	</td>
</t:parameter>


Am 01.10.2009 um 09:53 schrieb cordenier christophe:

> Hi
>
> Maybe you can achieve this by setting the addRow parameter on the
> AjaxFormLoop. Define your own AddRowLink that checks a condition  
> before
> launching the AddRow Event...
>
> 2009/10/1 Stefan <st...@wammel.com>
>
>> Hi,
>>
>> is it possible to block adding further rows to an AjaxFormloop?
>> Inside my addRow method i check some things and in some cases I  
>> don't want
>> to add further rows.
>> In these cases i return a FALSE (tried NULL also), but the last row  
>> will be
>> appended twice (or more times).
>>
>> What's going wrong here?
>>
>> Thanks,
>> Stefan


Re: Issues with AjaxFormloop and addRowLink

Posted by cordenier christophe <ch...@gmail.com>.
Hi

Maybe you can achieve this by setting the addRow parameter on the
AjaxFormLoop. Define your own AddRowLink that checks a condition before
launching the AddRow Event...

2009/10/1 Stefan <st...@wammel.com>

> Hi,
>
> is it possible to block adding further rows to an AjaxFormloop?
> Inside my addRow method i check some things and in some cases I don't want
> to add further rows.
> In these cases i return a FALSE (tried NULL also), but the last row will be
> appended twice (or more times).
>
> What's going wrong here?
>
> Thanks,
> Stefan