I'd rather override isEnabled and onDisabled, e.g.

new TextField() {
        boolean isEnabled() {
                return isTextFieldReadOnly;
        }
        void onDisabled(final ComponentTag tag) {
                tag.put("readonly", "readonly");
        }
}

-Matej

Martijn Dashorst wrote:
> AttributeModifier readonly = new AttributeModifier("readonly", true,
> "readonly");
> readonly.setEnabled(isTextFIeldReadOnly);
> textfield.add(readonly);
> 
> Martijn
> 
> On 12/14/06, Carfield Yim <[EMAIL PROTECTED]> wrote:
>> For Wicket 1.3, look like this is not working, once I add
>> [readonly=""] at the markup the field is readonly for sure.
>>
>> Just wonder can I Programmatically set readonly property of form
>> component at wicket 1.3?
>>
>> On 11/21/06, Otan <[EMAIL PROTECTED]> wrote:
>>> I'm using Wicket 2.0
>>>
>>> I can make a TextField readonly by doing this.
>>> tf.add(new AttributeModifier("readonly", new Model("readonly")));
>>> with this markup
>>> <input wicket:id="username" name="un" type="text" readonly="" />
>>>
>>> Does Wicket provides a method that make me do something like this
>>> to a form component?
>>> tf.setReadOnly(false);
>>>
>>> just like how it's easy in Wicket to setEnabled() a component.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>>> opinions on IT & business topics through brief surveys - and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>
>>> _______________________________________________
>>> Wicket-user mailing list
>>> Wicket-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>>>
>>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys - and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 
> 


-- 

     get professional wicket training and consultation
     http://www.wicket-support.com



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to