You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Przemysław Wojnowski <pr...@nask.pl> on 2009/06/30 12:47:09 UTC

T5: Enabling disabled datefield

Hi!
Is there a way to submit datefield, which has attribute disabled="true"
in template but was enabled using JavaScript on page.
Currently enabling field using JS does nothing and datefield is not
submitted, although it should IMHO.
Or is there some other way to have field disabled by default, but with
possibility of enabling it and submitting its value?

Example:
--- template ---
<t:checkbox t:id="enableDate" t:value="dateEnabled"
onclick="$('date').disabled = !$('date').disabled;" />
<t:datefield t:id="date" t:value="date" t:format="yyyy-MM-dd"
t:disabled="true" />

--- page class ---
private Date date;
public Date getDate() { return date; }
public void setDate(Date date) {
    log("date", startDate);
    this.date = date;
}

In code above setDate() is not called, even though datefield was enabled
using JS.

Regards,
Przemysław Wojnowski


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


Re: T5: Enabling disabled datefield

Posted by Przemysław Wojnowski <pr...@nask.pl>.
It works. Thank you very much!

> Hi,
> 
> Because you set t:disabled="true"  to the datefield statically, so in the form submit process, its value would not be updated always.
> 
> You can dynamically set the 'disabled' like t:disabled="!dateEnabled", then you will get the value.
> 
> DH
> http://www.gaonline.com.cn
> 



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


Re: T5: Enabling disabled datefield

Posted by ningdh <ni...@gmail.com>.
Hi,

Because you set t:disabled="true"  to the datefield statically, so in the form submit process, its value would not be updated always.

You can dynamically set the 'disabled' like t:disabled="!dateEnabled", then you will get the value.

DH
http://www.gaonline.com.cn

----- Original Message ----- 
From: "Przemysław Wojnowski" 
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, July 02, 2009 4:39 PM
Subject: Re: T5: Enabling disabled datefield


> Hi again!
> I know that simple components are not that interesting.
> Maybe there is someone who also uses this components and knows why it
> doesn't work (or maybe should not work).
> 
> Przemysław Wojnowski wrote:
>> Hi!
>> Is there a way to submit datefield, which has attribute disabled="true"
>> in template but was enabled using JavaScript on page.
>> Currently enabling field using JS does nothing and datefield is not
>> submitted, although it should IMHO.
>> Or is there some other way to have field disabled by default, but with
>> possibility of enabling it and submitting its value?
>> 
>> Example:
>> --- template ---
>> <t:checkbox t:id="enableDate" t:value="dateEnabled"
>> onclick="$('date').disabled = !$('date').disabled;" />
>> <t:datefield t:id="date" t:value="date" t:format="yyyy-MM-dd"
>> t:disabled="true" />
>> 
>> --- page class ---
>> private Date date;
>> public Date getDate() { return date; }
>> public void setDate(Date date) {
>>     log("date", startDate);
>>     this.date = date;
>> }
>> 
>> In code above setDate() is not called, even though datefield was enabled
>> using JS.
>> 
>> Regards,
>> Przemysław Wojnowski
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

Re: T5: Enabling disabled datefield

Posted by Przemysław Wojnowski <pr...@nask.pl>.
Hi again!
I know that simple components are not that interesting.
Maybe there is someone who also uses this components and knows why it
doesn't work (or maybe should not work).

Przemysław Wojnowski wrote:
> Hi!
> Is there a way to submit datefield, which has attribute disabled="true"
> in template but was enabled using JavaScript on page.
> Currently enabling field using JS does nothing and datefield is not
> submitted, although it should IMHO.
> Or is there some other way to have field disabled by default, but with
> possibility of enabling it and submitting its value?
> 
> Example:
> --- template ---
> <t:checkbox t:id="enableDate" t:value="dateEnabled"
> onclick="$('date').disabled = !$('date').disabled;" />
> <t:datefield t:id="date" t:value="date" t:format="yyyy-MM-dd"
> t:disabled="true" />
> 
> --- page class ---
> private Date date;
> public Date getDate() { return date; }
> public void setDate(Date date) {
>     log("date", startDate);
>     this.date = date;
> }
> 
> In code above setDate() is not called, even though datefield was enabled
> using JS.
> 
> Regards,
> Przemysław Wojnowski
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


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