@MailSend via JavaScipt button code

I hava form with a Notes Button hotspot. When user clicks it, it submits the
form and end out an email because I have and @MailSend formula built into the
Button properties.

On another form, I use passthru JavaScript for the button because I also run a
field valaidation using JavaScript that is in the JS Header, to make sure user
has entered data in the fields before submission. Here is the code which
creates the button. The name of the validation function is validate().

{]

When using the Notes button to submit, the @MailSend formula is located in the
button properties. But when using JavaScript to create and run the button,
there is no place to put the @MailSend formula. When using this approach,
where can I put the @Mailsend formula to get it to run. I have tried many
differnent places like WebQueery Save, onSubmit, etc., and it doesn’t run.
Can someone please provide some help and suggetions?
Thank You Very Much!!
Kenn

Subject: @MailSend via JavaScipt button code

Run validate() from the onsubmit event and use a Formula Language button.

Subject: RE: @MailSend via JavaScipt button code

Stan, I spoke to soon on this. I doesn’t work like I want it to. I does the front end JavaScript field valadation, but I has a $$Return field and an @MailSend formula in the send button which gets some fields out of the docuement and sends an email to a hard coded address in the @MailSend formula.

The problem is that even though I get the field validation prompt, it still goes ahead and sends the email and the $$Return acknowledgement. This of course is not good because it;s going ahead and sends the email without grabbing the name field and putting it in the email, so its being sent with the name missing.

What can i do now?

Thanks,

Kenn

Subject: RE: @MailSend via JavaScipt button code

Thanks Stan, and I thought I had tried that already. You are a genius. It worked like a champ. Hope you are doing well.

Kenn

Subject: RE: @MailSend via JavaScipt button code

Stan, I spoke to soon on this. I doesn’t work like I want it to. I does the front end JavaScript field valadation, but I has a $$Return field and an @MailSend formula in the send button which gets some fields out of the docuement and sends an email to a hard coded address in the @MailSend formula.

The problem is that even though I get the field validation prompt, it still goes ahead and sends the email and the $$Return acknowledgement. This of course is not good because it;s going ahead and sends the email without grabbing the name field and putting it in the email, so its being sent with the name missing.

What can i do now?

Thanks,

Kenn

Subject: RE: @MailSend via JavaScipt button code

The call to the validation function must be in the form of:

return validate()

and the validate() function MUST return false if validation fails. If the onsubmit event code returns false, the Domino-generated _doClick() function never calls the form’s submit() method, and if there is any code or button on the form that does an end-run around _doClick(), the onsubmit event itself will prevent the form from submitting (provided JavaScript is enabled at all in the browser).