By Date: <-- -->
By Thread: <-- -->

pre submit checks



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
-- 
bestsolution.at EDV Systemhaus GmbH
http://www.bestsolution.at

Attachment: signature.asc
Description: This is a digitally signed message part