Всем привет,Есть форма с валидацией библиотеки ref
...
jQuery(document).ready(function ($) {
ShowCaptureImage();
$(".has-error").bind('change keypress', function () {
$(this).removeClass("has-error");
});
$("#register_username").focus();
$("input,textarea,select").jqBootstrapValidation(
{
preventSubmit: true,
submitError: function($form, event, errors) {
alert( "submitError errors::"+var_dump(errors) + " : " + (typeof errors) )
return true;
// Here I do nothing, but you could do something like display
// the error messages to the user, log, etc.
},
submitSuccess: function($form, event) {
alert("OK");
MakeOperatorRegister();
event.preventDefault();
},
filter: function() {
return $(this).is(":visible");
}
}
);
});
...
<!-- Register Form --><divclass="row"><divclass=" col-sm-offset-2 col-sm-offset-right-2"><h3>Enter your personal data and you will receive confirmation email soon.</h3><formrole="form"class="form-horizontal"action="http://local-wprods.com/register"method="post"accept-charset="utf-8"id="form_register"name="form_register"enctype="multipart/form-data"><inputtype="hidden"name="ci_csrf_token"value=""/><divclass="control-group form-group "><divclass="controls"><labelfor="register_username">Username</label><inputclass="form-control editable_field"type="text"id="register_username"name="register_username"value="Serge 1"size="20"maxlength="50"data-validation-required-message="Please enter your username."data-validation-ajax-ajax="http://local-wprods.com/main/register_check_username"><pclass="help-block">Would be checked if username is unique in system.</p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_email">Email</label><inputclass="form-control editable_field"type="text"id="register_email"name="register_email"value="nilov@com.ua2"size="20"maxlength="50"data-validation-required-message="Please enter your email."data-validation-ajax-ajax="http://local-wprods.com/main/register_check_email"><pclass="help-block">Would be checked if email is unique in system.</p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_password">Password</label><inputclass="form-control editable_field"type="password"id="register_password"name="register_password"value=""size="20"maxlength="128"data-validation-required-message="Please enter your password."autocomplete="off"><pclass="help-block">Must be at least 6 chars.</p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_password_2">Confirm Password</label><inputclass="form-control editable_field"type="password"id="register_password_2"name="register_password_2"value=""size="20"maxlength="128"data-validation-required-message="Please enter your name confirm password."data-validation-matches-match="register_password"data-validation-matches-message="Must match password entered above"autocomplete="off"><pclass="help-block">Must be equal Password field.</p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_first_name">First Name</label><inputclass="form-control editable_field"type="text"id="register_first_name"name="register_first_name"value="First Name3"size="32"maxlength="32"data-validation-required-message="Please enter your name first name."><pclass="help-block"></p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_last_name">Last Name</label><inputclass="form-control editable_field"type="text"id="register_last_name"name="register_last_name"value="Last Name4"size="32"maxlength="32"data-validation-required-message="Please enter your name last name."><pclass="help-block"></p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_company">Company Name</label><inputclass="form-control editable_field"type="text"id="register_company"name="register_company"value="Company5"size="32"maxlength="45"><pclass="help-block"></p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_phone">Phone</label><inputclass="form-control editable_field"type="text"id="register_phone"name="register_phone"value="phone6"size="16"maxlength="16"><pclass="help-block"></p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_user_url">Website</label><inputclass="form-control editable_field"type="text"id="register_user_url"name="register_user_url"value="http://user_url.com"size="100"maxlength="100"><pclass="help-block"></p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_subscriber">Subscribe to email news about new products/blog articles</label><inputclass="editable_field"type="checkbox"id="register_subscriber"name="register_subscriber"value="1"><pclass="help-block">Later you could to detail which notifications do you want to recieve.</p></div></div><divclass="control-group form-group "><divclass="controls"><labelfor="register_i_agree">I agree to follow rules of site.</label><inputclass="editable_field"onclick="javascript:register_i_agreeonChange();"type="checkbox"id="register_i_agree"name="register_i_agree"value="1"><pclass="help-block">To must check it to register.</p></div></div><divid="success"></div><!-- For success/fail messages --><sectionclass="row disable-the-width col-md-offset-2-2 col-lg-offset-3-3"><divclass=" btn-group pull-right editor_btn_group "><divclass="col-xs-6 "><buttontype="submit"id="btn_submit"class="btn btn-primary">Submit</button></div><divclass="col-xs-4"><buttontype="reset"class="btn btn-cancel-action"onclick="javascript:document.location='http://local-wprods.com/home'">
Home
</button></div><divclass="col-xs-2"><imgsrc="http://local-wprods.com/static/images/modern-business/clear-data.png"alt="Clear All Data"title="Clear All Data"class="a_link img_clear_data"onclick="javascript:clearAllData()"></div></div></section></form></div></div><!-- /.row →
А как правильно ?
...
Валидация работает но
1) Если неправильно заполнено 1 поле, то при нажатии сабмита красным цветом выделяются ВСЕ поля на форме, а не только поле с ошибкой как хотелось бы.
2) В полях имени пользователя и мейла прописаны обработчики для проверки на сервере data-validation-ajax-ajax= - но они не вызываются - в консоли вызова нет...
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Здравствуйте, подскажите какой тег использовать для увеличения значения, пример на картинке.
Вроде, про такой тег я слышала. Если есть тег прогресс бар, значит и такое должно быть.
Question
mstdmstd
Всем привет,Есть форма с валидацией библиотеки ref
А как правильно ?
...
Валидация работает но
1) Если неправильно заполнено 1 поле, то при нажатии сабмита красным цветом выделяются ВСЕ поля на форме, а не только поле с ошибкой как хотелось бы.
2) В полях имени пользователя и мейла прописаны обработчики для проверки на сервере data-validation-ajax-ajax= - но они не вызываются - в консоли вызова нет...
А как правильно?
Спасибо!
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.