Bootstrap and formvalidation.io: display .help-block on one line

Firsim

I use Bootstrap 3.3.4 and formvalidation 0.6.1 me need display .help-block for right to display errors formvalidation.io (i use .form-horizontal).

I tried to use (out of service):

.help-block {
    display: inline;
}

My form:

<form class="form-horizontal" method="post" action=""   id="formProfile">   

<div class="form-group">
<label for="email" class="col-sm-3 control-label">E-mail</label>
<div class="col-sm-4">
<input name="email" id="email" 
type="email" class="form-control"
>
</div></div>

<div class="form-group">
<label for="nick" class="col-sm-3 control-label">Nick</label>
<div class="col-sm-4">
<input name="nick" id="nick" 
type="text" class="form-control"
>
</div></div>

</form>

How to make what errors are displayed on the right?

Phuoc Nguyen

FormValidation's err.container option allows to define messages area in various options: * A CSS selector * A callback * tooltip * popover

In your case, you can use a callback to indicate the message area.

The HTML code:

<div class="form-group">
    <label for="email" class="col-sm-3 control-label">E-mail</label>
    <div class="col-sm-4">
        <input name="email" id="email" type="email" class="form-control">
    </div>

    <!-- The messages are shown here -->
    <div class="col-sm-5 messageContainer"></div>   
</div>

<div class="form-group">
    <label for="nick" class="col-sm-3 control-label">Nick</label>
    <div class="col-sm-4">
        <input name="nick" id="nick" type="text" class="form-control">
    </div>

    <!-- The messages are shown here -->
    <div class="col-sm-5 messageContainer"></div>
</div>

The Javascript:

$('#formProfile').formValidation({
    framework: 'bootstrap',
    err: {
        container: function($field, validator) {
            // Look at the markup
            //  <div class="col-sm-4">
            //      <field>
            //  </div>
            //  <div class="col-sm-5 messageContainer"></div>
            return $field.parent().next('.messageContainer');
        }
    }
    ...
});

The result looks like the following image:

Showing messages in the right

The Showing messages in custom area example also provides more helpful examples.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to display input buttons on one line in Bootstrap?

From Dev

FormValidation on modal bootstrap

From Dev

One line block and if condition

From Dev

How to display two images on one line Bootstrap 3

From Dev

Bootstrap: Make help-block inline

From Dev

Bootstrap 3 help-block layout issue

From Dev

How to display the button in one line after the input tag, which is embedded in a div block?

From Dev

AngularJS + bootstrap carousel help to display all the images

From Dev

Formvalidation.io and array input fields with index

From Dev

Validate Dynamic input filed with "formvalidation.io"

From Dev

Fuelux wizard and formvalidation.io - an ajax

From Dev

formvalidation.io dealing with generated code

From Dev

Justified navbar and display inline-block with Bootstrap

From Dev

Bootstrap - Modal keeps "display: block" when hidden

From Dev

display:inline-block is not working in Bootstrap

From Dev

Justified navbar and display inline-block with Bootstrap

From Dev

Display inline block causing a strange line to appear

From Dev

Bootstrap collapse display one at a time

From Dev

Display multiple values in one line

From Dev

Materialize display cards in one line

From Dev

Display output in one line SQL

From Dev

Display HTML text on one line

From Dev

How to call Bootstrap formValidation with Jquery UI dialog

From Dev

display inline-block. How to prevent pushing the block to the new line?

From Dev

Bootstrap's Help Block with icon messes up the form

From Dev

Bootstrap menu - borders not in one line

From Java

Catch multiple exceptions in one line (except block)

From Dev

Ruby syntax for while block in one line

From Dev

Css how to set 3 block block/div's in one line

Related Related

HotTag

Archive