Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How do I: grey out text areas if they are selected as not required?

Avatar

Level 2

Hello, again.

I have a form which the user can enter info in text fields or check a checkbox to N/A the whole section.  I would like to grey out the relevant text fields if the user chooses to N/A the section.  I would also like to have other N/A check boxes automatically crossed if the user checks the main n/a box.  There are many of these on the form so hoping it would be fairly simple and straigtforward?

Your help, as always, is very much appreciated.

Stephanie

22 Replies

Avatar

Former Community Member

If you group these sections into subforms you can set the background color of the subform to grey and that whole section will be greyed out.

Paul

Avatar

Level 2

Thanks for the reply.

What do I have to do to create the trigger? Is there something simple I can do from the palettes or do I have to script this?

Im not familiar with scripting. Is it a mammoth task?

Avatar

Former Community Member

Its not rocket science by any stretch but you will need a trigger on the form .....when the user checks a box or clicks a button. That will cause an event in the form and we can write a script on that event taht will grey out the subform. If you want to attach your form I can do the 1st one for you so you can see how to accomplish it. Let me know what the trigger is and what you wantt o grey out.

Paul

Avatar

Level 2

Thank you Paul.  I have given the form for you to take a look at.  You will see there are many sections. If you look at section 7.2, there is an N/a box that the user could select.  All the subsections all the way down to 7.2.4 could be greyed out and the comments n/a box could be automatically checked.  Another example is section named Attachement 1.  If the user selected No, then all the n/a boxes could be auto checked.

Many, many thanks.

Stephanie.

Avatar

Level 2

Can i send the attachment as private message?

Avatar

Former Community Member

Private messages do not allow attachments ...but you can send it to LiveCycle8@gmail.com.

Paul

Avatar

Level 2

OK, sent to the gmail address.

Avatar

Level 2

Hi Paul.

Thank you again for sending the form. I hope you dont mind if I just ask if you could tell me how to narrow it down to just the fields rather than the whole section being grey.  If its a messy process for a newbie like me then do feel free to say so.

all answers are appreciated,

Avatar

Level 7

Hi Paul,

Would it be any better or worse for form performance if the unused sections were hidden from the layout? I've got a large form coming up with many sections needed that can disappear if they don't apply, it sounds similar to what's being described here. I'm wondering if I'd be better off hiding them or just leaving them visible and locking them/graying them out.

thanks,

Dave

Avatar

Former Community Member

There is no impact on performance either way. The performance is primarily governed by the number of objects you have on the form. It makes no difference if they are greyed out or invisible ....they still have to be created.

Paul

Avatar

Level 2

you can use something like

this.access="read-only";

Avatar

Former Community Member

Hi Dave,

If the sections are not being used, they just take up unnecessary space. Personally I think it's better to hide the irrelevant sections.

Avatar

Level 2

Hi Paul.

Thanks for sending the form with the fields only greyed.  That is just what I needed.  I did notice there is a tag for access = read-only however you can still enter info into the fields.  Was this meant to  happen?  It would be good to have them read-only if possible.  From a compliance persepective these fields still have to be visible but it saves confusion this way.

I really appreciate your effort with me on this.

Stephanie.

Avatar

Former Community Member

I just checked my version and they are locking when they are N/A.

Are you using the aul2 version?

Paul

Avatar

Level 2

Yes its the Pauls2.

It does grey out, but i can add and delete text.  I have Adobe LC v8.

Avatar

Former Community Member

When you render as a PDF then hit the N/A checkbox that is when the field becomes readOnly. Is that what you are seeing?

Paul

Avatar

Level 2

I open as a regular pdf and then check the NA box.  The fields grey out but dont lock down.  I should not be able to type and change text in those fields correct? As I can right now.

Sorry

Avatar

Former Community Member

Something wierd is going on ....I do the same and they are locked. Can you hit Ctrl-J and see if any errors are showing up?

Can you sned me your version of the form?

Paul

Avatar

Level 2

Hi Paul.

Im sending you back the form through your gmail address.

I also tried making the grey out switch on section 5.2, first part labeled Hardware.  I put the script under the checkbox and entered the lines for the two text fields.  But sadly its not working for me.  I guess its a "me" error, but not sure where I went wrong.