Expand my Community achievements bar.

How do can I have the form fill in a check box if the user has entered text in a textbox?

Avatar

Level 4
I have a form that is submitting an xml data file that is picked up by MS Word and used to populate a document. However, there's a 'Miscellaneous' field where the user can type in addtional information that would not drop easily into the Word document (exceptions, items not on the drop down lists, etc.). I'd like to test to see if that Miscellaneous field has infomation in it and if it does, to set a invisible checkbox to "1" so that I can insert a text message in the Word document that there's additional information in the .pdf form that will have to be addressed manually in the Word document.



I've tried

if(Misc.rawValue !== "")

otherinfo.rawValue = 1;



but while it doesn't generate a Javascript error, it doesn't set the value either, and I haven't found any function that checks for whether a field is empty. I'm sure there's got to be a way to do this, but I'm stumped. Any help greatly appreciated!



Bill
2 Replies

Avatar

Level 7
It appears you are using LiveCycle Designer, so you will have to use the syntax of FormCalc or LiveCycle Designer JavaScript.



For FormCalc:



if(HasValue(Misc)) then

otherinfo = 1

else

otherinfo = 0

endif



For JavaScript



if(HasValue(Misc.rawValue))

otherinfo.rawValue = 1;

else

otherinfo.rawValue = 0;



I added code to clear the check box if the user clears the field.

Avatar

Level 4
Thanks, but using your script, I'm getting a Javascript error that HasValue isn't defined. I'm using Designer 7, if that matters.