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.

Hiding null values.

Avatar

Level 2

Some help with this one please.

I have a few text fields that have quite a few entry's in it derived from questions asked via radio buttons.  Before any answers are given all I have in these text fields are a lot of null expression.  Then as the questions  get answered the nulls change to the given responses. At the end of the form I am left with answers mixed up with nulls.  Is there a way of hiding the nulls and only displaying the answers.

I have tried a couple of scripting ideas but none have worked with the hidden expression.

Raffe.

9 Replies

Avatar

Level 10

You can do it with Patterns - from the Field tab of the Object palette.

You want to check the boxes under Handling Empty and Zero Values - Allow Empty and Allow Zero. At least I know Allow Zero gets rid of zeroes and I think the Allow Empty will stop nulls but I'm not sure.

Avatar

Level 2

Thanks Jono.

Have tried this but its not working. Text is being displayed in theses text fields not numbers, so the null's are not being removed and only the selected answers from the radio buttons get displayed.

This is the script that I am trying to get to work but not having any joy.

if (this.rawValue == "" || this.rawValue == "null")

{

     this.presence = "hidden";

}

 

this.rawValue = "" + Q11.MT.TF1.rawValue + "\n"+ Q12.MT.TF1.rawValue + "\n"

Raffe.

Avatar

Level 10

So how are you getting the values into the text fields?

If the text fields are generating nulls to begin with you are using the Calculate event? If you are filling the text fields via the radio buttons then it would be better to use the Change event on the radio buttons.

Avatar

Level 2

Hi Jono.

I have various radio buttons with 4 options each. They give an answer to a

text field associated with the question and radio button. Then at the

beginning of my form I have 4 separate text fields that give an overview of

the answers generated by all the questions as an executive brief.

To get all my answers I am using the calculated event as suggested by you.

It is in these text fields that would like to hide all the nulls generated

from the text fields lower down on my form. As at the moment all these

nulls run over 3 pages. Once my form is finished at the moment I now have

to go and delete all nulls. It would be a lot better if said nulls were

just hidden.

Raffe.

Avatar

Level 10

Can you share your form? It would be easier to figure out what's going on.

Avatar

Level 2

Hi Jono.

Thanks for offering to have a look at this form and try and find a

solution. I am away from a pc at the moment and only on my phone and the

browser doesn't support the page that allows one to share files. Here's my

email address raffe.stone@gmail.com. Make contact and I will forward it on

to you from there.

Thanks.

Raffe.

Avatar

Level 10

Hi Raffe, got the file - I'll take a look at it as soon as I can.

Avatar

Level 2

Thanks Jono. I hope you can come up with a solution to this little problem.

Much appreciated.

Raffe.