Short: webservice call should be done in the submit handler.

I think the data should not be sent to Campaign Monitor webservice unless the form is valid. It's not the case at the moment since the webservice is called in the form validation handler.

I've altered the form using hook_form_FORM_ID_alter(), marking some custom fields as required. I am then able to subscribe without filling the (altered) required fields. I think this is not the excepted behavior.

CommentFileSizeAuthor
#2 submithandler-1395344-3.patch1.58 KBnclavaud

Comments

cableman0408’s picture

Assigned: Unassigned » cableman0408

I see the problem, but it's create this way to be able to mark/highlight the form-errors with form_set_error, if the CM web-service reports any problems or fails. I can look into the issue, but at the time the code was written I could not find any another solution. Any suggestions on how to solve this problem is welcome :-)

You could, for now, override the validation function (I know that its not an optimal solution).

nclavaud’s picture

StatusFileSize
new1.58 KB

You can use form_set_error() and $form_state['redirect'] = FALSE; together to display the form again (as a failed validation would do).

Here is a patch (not tested).

nclavaud’s picture

Status: Active » Needs review
cableman0408’s picture

Thank you very much, I will look into this.

cableman0408’s picture

Status: Needs review » Fixed

The patch have been used to resolve this issue in the development branch. If you could test that it now works for your case... I would appreciate it. :-)

nclavaud’s picture

Yes it does work as expected now. Thanks!

selvaraj123’s picture

HI All

Could you please tell me step for campaign monitor module.

Regards
Selvaraj.C

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.