Expand my Community achievements bar.

Button to work as email submit button error

Avatar

Level 2

Hi,

I dragged a button onto my form to be used as an email button because I need to retrieve a name from a field on my form and put it into the cc of the email. I have the button with the script written to retrieve the data but funny thing is that the email button works (cc was working fine) but the fields on the form wasn't working properly after that - the fields on the form wasn't validated and the scripts that I wrote for those fields were not working as well. Does anyone have any idea why?

Btw I'm not sure if this would affect my form but I have my scripts for other fields on the form under Show: change but my email javascript for this button is under Show:click.

This is the code that I have for the button under Show:click:

event.target.submitForm({cURL:"mailto:myEmail@hotmail.com?cc="+lineManager.rawValue+"&subject=Access form.",cSubmitAs:"XML",cCharset:"utf-8"});

Regards,

Florian

3 Replies

Avatar

Level 10

Hi,

It would be better to declare a variable first and set its value to the lineManager.rawValue. Then you would use the variable in the submitForm script.

There are examples here:

For Acrobat/Reader v9 and below: http://assure.ly/dYQFb4.

For Acrobat/Reader v9 and above: http://assure.ly/hM2A5y.

Have a look at the third button on the forms.

Hope that helps,

Niall

Avatar

Level 2

Hi Niall,

Thanks for your examples. My email script is working fine but my other fields on the form don't seem to work after I include the script for the email button.

I have 2 mandatory fields (with some functions in them) on the form and users are supposed to input data into these two fields before they can proceed with submitting the form. So technically when I try to email the empty form, it should indicate that there are two fields that have no input, but instead it opens my outlook and randomly pick someone from my contact list and put it into the cc field in my email.

I'm going to try validating the fields too...lets see if that works.

Avatar

Level 2

I understand now....It's working now. Thanks.