I am adding a selection of options via a list box, however the last option should be other and allow for freetext of this answer.
Any ideas how I can do this?
Thanks in advance!!
in the chartnote translation, use a mel statement so that if document.listbox == "Other" then "" else cfmt(document.listbox,"Listbox answers:", "","") or something along those lines. then create another document variable within a visbility field triggered by document.listbox == "Other". Does that make sense?
I was just thinking about this and this would only work if "Other" was the ONLY option selected. If you wanted to make the freetext appear even when other options are selected, this would be a bit more involved. You would need to write a function for that. basically create a comma separated array of the listbox using the getfield data symbol, then say that if match(array,"Other") > 0, remove the word "other", add a comma, and add the contents of the editfield if it is not blank.
Ken - I am pretty new to VFE coding. Would I add the code that you suggested directly to the translation of the listbox after the cfmt that is already prepopulated?
Right now it is populating just the default information that translates when I created the listbox.
Thank you so much for your help!!
So what you will want to do is to clear the default text translation altogether. Then you can add any coding that you want to that field! Think of the CFMT that is there as a code in and of itself. That is coding that is used for formatting and you can add that into your other coding. Hope this helps
I haven't tried this but give this a shot. Document.other would be the editfield.
{listarray = getfield(document.listbox,",","")
sizearray = size(listarray)
position = match(listarray,"Other")
if match(listarray,"Other") > 0 and document.other "" then sub(listarray,position,1)
else ""
endif
}