cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide and show a Text field

nobel
Champ in-the-making
Champ in-the-making
I have a checkbox field. If i check the checkbox field, I need to make the appearance of a Text box under the checkbox field to enter some comments in the checkbox. Can anybody guide me?

Thanks in advance,
nobel
3 REPLIES 3

billerby
Champ on-the-rise
Champ on-the-rise
nobel,

If you could be a little more specific it would be easier to provide help. Are you using the property sheet?

Regards
/Erik

nobel
Champ in-the-making
Champ in-the-making
Thanks Mr. Billerby for coming forward to query my problem,    

     Yes, I am using property-sheet to show the text-box field(in the page) in the web-client-config-custom.xml. And, i define the property details for the text-box field in the model file.

My problem is :
     The customer fill-up some details and submit the application form to admin for approval. The admin takes a look at the entered details. Admin has an option to Accept/Reject the application form. He is given a check box. If he checks the box that is, Rejecting Application form. If he is not going to reject, then he will not bother about the check-box and continue to proceed on next transition in the workflow.

1. If the check box is selected, i have to make the appearance of textbox to enter the reason of "Why he is rejecting the form".

2. Or else, I have one more option given. That is, If i am unable to hide and show as per the checking of check box, At least, i want to disable the textbox while the check box is unchecked. If the checkbox is checked, then i should have the facility to enter some reason in the text box [text box has to be in enable mode].

Thanks in advance,
nobel

billerby
Champ on-the-rise
Champ on-the-rise
Hi again,

Try to override the HtmlTextRenderer which is the default one for rendering html input texts. To do this you will first need to write a component-generator:

http://wiki.alfresco.com/wiki/Component_Generator_Framework

This generator initializes your renderer, where you can wrap the html input element round a hidden div, then you will probably need to implement a renderer for the checkbox as well that outputs an onclick show/hide event, and as well writes the javascript toggle script.

Have a look at the MultilingualTextAreaRenderer in the Alfresco source for an example of a renderer and its corresponding generator (MultilingualTextAreaGenerator).

One thing to watch out for is what to configure where in the faces-config files. Read this carefully: http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions#JSF_configuration_files

Happy coding
/Erik