pre submit checks
- From: Udo Rader <udo.rader (at) bestsolution.at>
- Date: Thu, 09 Feb 2006 15:36:13 +0100
Hi,
Somehow I am not able to make reasonable pre submit checks using itext.
What I want is to execute some arbitrary _javascript_ code before a form is
submitted.
Here's what I do:
----------CUT-----------
PdfFormField button = new PdfFormField(pdfWriter_, llx, lly, rux,lux, null );
PdfAction submit = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_XFDF );
PdfAction some_action = PdfAction._javascript_( "app.alert('hello');", pdfWriter_ );
button.setAction( submit );
button.setAdditionalActions( PdfName._javascript_, some_action );
----------CUT-----------
This way, the form is actually submitted, but the alert never shows up.
Then I tried to reverse the order:
----------CUT-----------
PdfFormField button = new PdfFormField(pdfWriter_, llx, lly, rux,lux, null );
PdfAction submit = PdfAction.createSubmitForm(url, null, PdfAction.SUBMIT_XFDF );
PdfAction some_action = PdfAction._javascript_( "app.alert('hello');", pdfWriter_ );
button.setAction( some_action );
button.setAdditionalActions( PdfName.SUBMITFORM, submit );
----------CUT-----------
Now the alert shows up, but the form is not submitted.
So what's the correct way to implement this?
thanks
Udo Rader
Attachment:
signature.asc
Description: This is a digitally signed message part