Form submit fix + default styles
This commit is contained in:
@ -1,3 +0,0 @@
|
|||||||
@import 'nib'
|
|
||||||
|
|
||||||
@require 'common'
|
|
||||||
|
@ -29,7 +29,8 @@ define('public', ['mailpoet', 'jquery', 'jquery-validation'],
|
|||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
// setup form validation
|
// setup form validation
|
||||||
$('form.mailpoet_form').validate({
|
$('form.mailpoet_form').each(function() {
|
||||||
|
$(this).validate({
|
||||||
submitHandler: function(form) {
|
submitHandler: function(form) {
|
||||||
var data = $(form).serializeArray() || {};
|
var data = $(form).serializeArray() || {};
|
||||||
|
|
||||||
@ -82,5 +83,6 @@ define('public', ['mailpoet', 'jquery', 'jquery-validation'],
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -65,6 +65,9 @@ class Widget extends \WP_Widget {
|
|||||||
$this->id_base
|
$this->id_base
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form_id = $this->id_base.'_'.$this->number;
|
||||||
|
$form_type = 'widget';
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
// before widget
|
// before widget
|
||||||
@ -73,12 +76,14 @@ class Widget extends \WP_Widget {
|
|||||||
// title
|
// title
|
||||||
$output .= $before_title.$title.$after_title;
|
$output .= $before_title.$title.$after_title;
|
||||||
|
|
||||||
// form
|
// container
|
||||||
$form_id = $this->id_base.'_'.$this->number;
|
|
||||||
$form_type = 'widget';
|
|
||||||
|
|
||||||
$output .= '<div class="mailpoet_form mailpoet_form_'.$form_type.'">';
|
$output .= '<div class="mailpoet_form mailpoet_form_'.$form_type.'">';
|
||||||
|
|
||||||
|
// styles
|
||||||
|
$styles = '.mailpoet_validate_success { color:#468847; }';
|
||||||
|
$styles .= '.mailpoet_validate_error { color:#B94A48; }';
|
||||||
|
$output .= '<style type="text/css">'.$styles.'</style>';
|
||||||
|
|
||||||
$output .= '<form '.
|
$output .= '<form '.
|
||||||
'id="'.$form_id.'" '.
|
'id="'.$form_id.'" '.
|
||||||
'method="post" '.
|
'method="post" '.
|
||||||
|
Reference in New Issue
Block a user