Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am creating a PDF form where the user will be selecting from a long list of 25 options. The completed form will be exported to an XFDF file, which will be automatically processed and put into a database. For each of the 25 options, they can either select "primary", one "secondary", or "none". There can only be one primary, but there can be many secondaries.

So if I wanted it to export correctly, I would make each choice a separate radio button group, and it would look like this:

Choice1: P() S() N()

Choice2: P() S() N()

...

Choice25: P() S() N()

If the user selected "P" for Choice1 and "S" for Choice2, it would export as

<field name="Choice1">
    <value>P</value>
</field>
<field name="Choice2">
    <value>S</value>
</field>

Which would be processed correctly. Unfortunately this doesn't prevent the user from picking "P" for multiple options. I have created a separate question for the possible solution of keeping the radio buttons, but somehow making the form enforce the no-homo-threesome rule ("only one P allowed" :P), here:

How to have many radio button field groups where only one group can have a certain value selected?

But I hate to pigeonhole solutions, and the stackexchange model meant I had to make the question specific. I also considered a different solution, and this question is about that possibility.

It would make more sense to switch the rows and columns here, and have a radio button group and 25 checkboxes:

Primary: Choice1() Choice2() ... Choice25() Secondary: Choice1[] Choice2[] ... Choice25[]

The radio button already enforces only allowing one choice, so this would work fine for data entry. But I can't just do that, because after the users fill out these forms, the data would not export correctly. the export would instead look like

<field name="Primary">
    <value>Choice1</value>
</field>
<field name="Choice2">
    <value>S</value>
</field>

And since it's supposed to go into the "Choice1" database column as a P, rather than the nonexistent "Primary" column, this won't work. Could I use the radio+checkbox approach, but somehow make the Primary selection export in the format I need it?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.