Page 1 of 1

How to validate fillable forms in word using java / docx4j ?

PostPosted: Tue Nov 13, 2018 10:47 pm
by vijusdm
I have word document which has table .
on left side just label , on right side editable fields with labels again.
How to ensure it is a editable field ?
and how to validate those fields like nullable ?

Re: How to validate fillable forms in word using java / docx

PostPosted: Wed Nov 14, 2018 6:22 am
by jason
Not enough info here to answer.

What sort of fields are they? This may help to answer your question about how to validate them

How do you want to edit them, with docx4j? Or would a user do so in eg Word?

Re: How to validate fillable forms in word using java / docx

PostPosted: Wed Nov 14, 2018 4:53 pm
by vijusdm
Those are fillable forms available inside table. Like a label and field to enter.
Example :
ID : <Textfield>

Also dependent validations like , if one field value is available , then we need to validate other field value : whether it is null or not.

Re: How to validate fillable forms in word using java / docx

PostPosted: Wed Nov 14, 2018 5:46 pm
by jason
You aren't talking in terms of the docx file format. Attach a sample docx?

Also please don't cross post: https://stackoverflow.com/questions/532 ... rd-in-java

Re: How to validate fillable forms in word using java / docx

PostPosted: Fri Nov 16, 2018 1:14 am
by vijusdm
Ok . Please find attached doc file .
As mentioned ,
User will enter the values in word document itself .
I need to parse and validate word document whether the field is null or not , on submit in web application. Field Like Requester Id .
Also conditional validation based on Yes/No option in 2nd row.

So please give suggestion as to how to carry out this .

Re: How to validate fillable forms in word using java / docx

PostPosted: Fri Nov 16, 2018 1:21 am
by vijusdm
Please find attached sample file.

Re: How to validate fillable forms in word using java / docx

PostPosted: Fri Nov 16, 2018 6:23 pm
by jason
I can see you are using content controls for the "fields". This is a good design choice :-)

You say the user will enter the values in the Word document itself. This is using Word? Are they constrained to eg Word on Windows, or could it be OSX, Android etc? Word Online? An alternative might be https://nativedocuments.com/ (I have an interest there)

With content controls, you can "bind" them. See further https://docs.microsoft.com/en-us/visual ... ew=vs-2017

With data bound content controls, it is easy to extract the data as an XML file. You can then use XML technology to validate.