How to loop through all text fieds in a form

I have a form, with a bunch of text fields in it. I want to have Edit and Save buttons. Edit buttons to edit the form and save to save it. When its saved, all the text fields are shown as read-only by setting "setReadOnly" to TRUE.

Currrently, I have this routine to set read/write:

privatevoid setReadWrite(){

// Set read-only to true for all text fiels

this.btnEdit.setVisible(_readOnly);

this.btnSave.setVisible(!_readOnly);

this.user_id.setReadOnly(_readOnly);

this.user_email_client.setReadOnly(_readOnly);

this.user_email_office.setReadOnly(_readOnly);

this.user_fname.setReadOnly(_readOnly);

this.user_lname.setReadOnly(_readOnly);

this.user_id.setReadOnly(_readOnly);

this.user_password.setReadOnly(_readOnly);

this.user_password_conf.setReadOnly(_readOnly);

this.user_phone_cell.setReadOnly(_readOnly);

this.user_phone_cell_aac.setReadOnly(_readOnly);

this.user_phone_client.setReadOnly(_readOnly);

this.user_phone_home.setReadOnly(_readOnly);

this.user_phone_office.setReadOnly(_readOnly);

}

Is there an easier way to look through all text fields in a form instead of naming each one of them? That way, I can re-use the same code in every page/form in the app.

Thanks

Message was edited by:

Sabir

[1503 byte] By [Sabir] at [2007-11-26 8:40:17]
# 1
Looks like no one seem to know this? I think it should be fairly easy and something that most developers would need. Gurus, where are you?
Sabir at 2007-7-6 22:16:41 > top of Java-index,Development Tools,Java Tools...
# 2
I just blogged on the topic ( http://blogs.sun.com/david). Please pay attention to the part about the application model restrictions. Cheers!-David
DavidBotterill at 2007-7-6 22:16:41 > top of Java-index,Development Tools,Java Tools...
# 3
Awsome! This is exactly what I was looking for. Thanks.
Sabir at 2007-7-6 22:16:41 > top of Java-index,Development Tools,Java Tools...