WebHare community

Custom form handler: get (selected) options for (multiple-answer) question

In a

PUBLIC OBJECTTYPE DealerFormTask EXTEND FormHandlerTaskBase

I can use results.response to get the entered data. However, in the case of a multi-checkbox field, I get:

 +TYPE: ['nJXvqjedbnDxo3o_ZmGMIw', 'SiJ-7fdk7DE07qOM5ipMyw']'.

These correspond to:

      <select guid="formcomp:fjcrWWLJUsFtPseJfvhAgg" type="checkbox" title="Type" name="type" pins="existence">
        <option rowkey="nJXvqjedbnDxo3o_ZmGMIw" title="Auto"/>
        <option rowkey="SiJ-7fdk7DE07qOM5ipMyw" title="Motor"/>

What would be the proper way to get the titles of these answers? Is there some form of this->...->GetQuestionPropertiesByName("type") to get the options?

the proper way would be to manually set names & rowkeys to desired values if you’re going to read them from code so your form doesn’t break if someone changes the title of a question or answer

and pin whatever can be pinned

Ok, sure, sounds good. But how to do that? Just manually set rowkey in the form source?

generally i just edit source from inside the formeditor