[ 
https://issues.apache.org/jira/browse/PDFBOX-3683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15863973#comment-15863973
 ] 

Maruan Sahyoun commented on PDFBOX-3683:
----------------------------------------

In the case of your form it looks like an index but it's not. The {{On}} state 
of each option in a radio button group is represented by a name, which happens 
to be {{0}}, {{1}} ... in the sample form you have. In the form Tilman created 
the name is {{a}}, {{b}}, {{c}} so {{getValueAsString}} will return {{b}} for 
example. I'll do some more testing with Acrobat and try to replicate it's 
behavior. But it might also hide details from the programmer using PDFBox as 
e.g. when for your sample for you'd like to choose {{Checking}} what's stored 
in the fields value {{/V}} is {{0}}. Currently for all fields apart form 
signature fields {{getValueAsString}} returns the {{/V}} entry.

So the question is if we's like to go a level up here (which makes it easier to 
use) or keep with the current low level design we have in PDFBox where one 
would need to know about how to handle the {{/Opts}} information which would be 
- get the value
- get the index of the option representing that value
- get the corresponding entry from {{/Opts}}


> Unexpected behavior when setting value for radio button with /Opts entry 
> -------------------------------------------------------------------------
>
>                 Key: PDFBOX-3683
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3683
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.4, 2.0.5, 2.1.0
>            Reporter: Maruan Sahyoun
>             Fix For: 2.1.0
>
>
> Setting the value for a radio button the behavior is unexpected as when 
> setting the value the entries in {{/Opts}} need to be used is there is such 
> entry otherwise the names for the {{On}} values in the normal appearances 
> entries need to be used. When getting the value always the set names entry is 
> returned.
> Also see the discussion at PDFBOX-3656.
> The {{/Opts}} entries shall only be considered when exporting or importing 
> the AcroForm fields data.  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to