I am learning VFE again, after several years of being away from it. We have a form with radio buttons that are not clearing properly when unchecked. When checked, text gets populated to the chart. When we add comments to a comments field, then uncheck the radio button, it still posts the radio button text for some reason. The MEL code is below. Has anyone experienced this, and if so, do you have a solution ?
The text "did not have X-rays" still populates, even when the button is unchecked . (Neither yes or no is checked) Thanks.
if hpi92<>"" then prhpi=prhpi+hret+" " else "" endif
if hpi92<>"" then prhpi=prhpi+sexi else "" endif
if hpi92=="No" then prhpi=prhpi+"did not have X-rays" else "" endif
if hpi92=="Yes" then prhpi=prhpi+"had X-rays" else "" endif
if hpi92=="Yes" and hpi93<>"" then prhpi=prhpi+" on "+hpi93 else "" endif
if hpi92=="Yes" and hpi94<>"" then prhpi=prhpi+" at "+hpi94 else "" endif
if hpi92<>"" then prhpi=prhpi+". " else "" endif
even though you clear the radio buttons, the text that was added to your text field won't be removed unless you clear the text field, or manually remove the text.
I see. Well, I attempted to clear the PRHPI field a couple different ways, but it did not help. I tried:
if prhpi<>"" and hpi92=="" then prhpi=="" else "" endif
Checks to see if the text field has content, then if the button is not populated, move null to the text field. Is there a better way to do this ?? Thanks.
John
It all depends on whether the text field is solely comprised of other field options, or whether your users can free text in the field. If solely from other fields, take your if statements and nest them with the final else setting the field to "", and don't append text to the field...build all of the text each time the code executes. If your users free text in the field, you don't want to auto-clear it...they'll get extremely mad if they have to retype data.