Expand my Community achievements bar.

SOLVED

Force user to enter text if checks YES check box

Avatar

Former Community Member

I have created a form with YES and NO check boxes.  If user checks YES, they need to provide written reason.  Is there a way to "force" user to enter text into text box if they check the YES check box?

Thanks,

Toyro

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Take a look at the attached. It contains some simple logic to encourage form fill based upon a "Yes" selection. There are many different ways to approach this issue.

Steve

View solution in original post

10 Replies

Avatar

Former Community Member

You cannot force any behaviour considering a user can simply choose to ignore submitting, printing, or saving the form. The best you can do is to encourage form completion through form validation; setting focus on the text field, error messages on field exit, on print events, etcetera.

Avatar

Former Community Member

yes, that is why i put 'force' in quotes! (forgive me if I use the "incorrect" words, I am quite new at this!)

Ok, this is what I am trying to accomplish - and I am also new to scripting - I did read a previous post from palacfanatic that seems like it may have similar, not exact, situation (this field is mandatory...)

I have completed forms where if I check YES I would need to provide info in a text box, if i didn't provide that info then I would not be able to continue completing form (error message keeps coming up that I need to provide info) unless I changed the YES to a NO. Is there a way to do that? (make a text box mandatory if YES box is checked?) or is my question still too general?

thanks, toyro

Avatar

Correct answer by
Former Community Member

Take a look at the attached. It contains some simple logic to encourage form fill based upon a "Yes" selection. There are many different ways to approach this issue.

Steve

Avatar

Former Community Member

PERFECT! This is what I need!

THANK YOU SO MUCH!

Avatar

Level 4

Can you help me out?  I am trying to do this backward.  I want a check box that is always checked. It is when the user unchecks the box that they need to enter in a comment.  Can that be done?

Thanks!

Jodi

p.s.  I am a beginner to LiveCycle designer and scripting so please be patient 

Avatar

Former Community Member

Hi Jodi,

Absolutely. I will forward a sample shortly.

Steve

Avatar

Former Community Member

Jodi,

Take a look at this. Let me know if you need further assistance.

Steve

Avatar

Level 4

Hi Steve,

It isn't working for some reason.  I don't know if it is because I only have the one field and then go to send email?  Does the form need to be saved as a dynamic PDF?  I attached to see if you could see what I have wrong.  Thanks for all the help!

Jodi

Avatar

Former Community Member

Hi Jodi,

Yes, it has to be saved as a dynamic PDF.

Additionally, there are some name mismatches in your form so the script was failing. My script defined page 1 as 'page1' while your form defined page 1 as 'Page1'. I renamed your form page 1 to 'page1' and the script worked fine.

I would recommend enabling the debugger in Acrobat for form developement. See Edit > Preferences and enable the following:

acrobat-debug.png


I added an additional button with some script on the button 'click' event.

The purpose is to intervene in the submission process, in your case submitting by email. With a single submit button the email dialogue fires regardless of failed form validation. By introducing a second button you can do form validation before enabling submission. The attached form has a visible button called 'submitBtn' and your original 'Submit By Email' button which is declared as 'invisible'. My 'submitBtn' is labelled 'Submit By Email'. When the button is clicked is does form validation. If validation succeeds, I call form1.page1.Button1.execEvent("click"); to submit to the email address attached to 'Button1'.

Take a look and see if it fits your requirements.

Steve

Avatar

Level 4

This is so cool!  This is exactly what I need.  There is so much that I have to learn.

Thanks tons!

Jodi

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----