juliya
10/10/2017 - 2:51 PM

request form

.contact-form {
    .box-sizing();
    .border-radius(23px);
    padding: 45px 55px;
    border: 1px solid rgba(163, 163, 175,0.7);
    background-color: rgba(255,255,255,0.7);
    h2 {
        text-align: center;
    }
    .btn {
        display: block;
        margin: 30px auto 0;
    }
}
.form-group {
    margin-bottom: 10px;
}
.form-control {
    display: block;
    .box-sizing();
    .border-radius(3px);
    border: 1px solid @border-color-light;
    padding-left: 18px;
    padding-right: 18px;
    width: 100%;
    height: 35px;
    font-size: 14px;
    font-family: @font-2;
    color: @border-color-light;
    background-color: rgba(255,255,255,0.75);
    .transition();
    &::-webkit-input-placeholder {
        font-size: 14px;
        font-family: @font-2;
        color: @border-color-light;
        .transition();
    }
    &::-moz-placeholder {
        font-size: 14px;
        font-family: @font-2;
        color: @border-color-light;
        .transition();
    }
    &:-moz-placeholder {
        font-size: 14px;
        font-family: @font-2;
        color: @border-color-light;
        .transition();
    }
    &:-ms-input-placeholder {
        font-size: 14px;
        font-family: @font-2;
        color: @border-color-light;
        .transition();
    }
    &:focus {
        border: 1px solid @text-color-light;
        color: @text-color;
        background-color: rgba(255,255,255,1);
        &::-webkit-input-placeholder {
            color: transparent;
        }
        &::-moz-placeholder {
            color: transparent;
        }
        &:-moz-placeholder {
            color: transparent;
        }
        &:-ms-input-placeholder {
            color: transparent;
        }
    }
}
.label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1;
    font-family: @font-2;
    &.focus {
        color: @accent-color;
    }
}
input[type="radio"] {
    display: none;
}
.form-group-radio {
    margin: 0 auto 20px;
    max-width: 244px;
    text-align: center;
    word-spacing: 20px;
}
.radio-label {
    position: relative;
    display: inline-block;
    vertical-align: top;
    padding-left: 20px;
    font-size: 16px;
    line-height: 1.1;
    font-family: @font-2;
    word-spacing: normal;
    &:before {
        content: '';
        position: absolute;
        top: 1px;
        left: 0;
        .box-sizing();
        .border-radius(50%);
        border: 1px solid @text-color-light;
        width: 16px;
        height: 16px;
        background-color: #ffffff;
    }
    &:after {
        content: '';
        position: absolute;
        top: 5px;
        left: 4px;
        .box-sizing();
        .border-radius(50%);
        width: 8px;
        height: 8px;
        background-color: @accent-color-dark;
        opacity: 0;
        .transition();
    }
}
input[type="radio"]:checked + .radio-label:after {
    opacity: 1;
}
textarea.form-control {
    padding-top: 10px;
    padding-bottom: 10px;
    height: 80px;
}
.email {
    display: none;
}

/*validation*/
.btn-form {
    background-repeat: no-repeat;
    background-position: center center;
    &.error {
        background-image: url("../img/ico-form-error.png");
        background-color: @error-color !important;
    }
    &.success {
        background-image: url("../img/ico-form-ok.png");
    }
}
.result {
    margin-top: 15px;
    font-size: 12px;
    line-height: 1.3;
    font-family: @font-2;
    text-align: center;
}

.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline,
.has-success.radio label,
.has-success.checkbox label,
.has-success.radio-inline label,
.has-success.checkbox-inline label {
    color: @accent-color;
}
.has-success .form-control {
    border-color: @accent-color;
    color: @text-color;
}
.has-success .form-control:focus {
    border-color: @text-color-light;
}
.has-success .input-group-addon {
    color: @accent-color;
    border-color: @accent-color;
    background-color: #dff0d8;
}
.has-success .form-control-feedback {
    color: #3c763d;
}

.has-error .help-block
{
    margin-top: 5px;
    font-size: 12px;
    font-family: @font-2;
    color: @text-color-lighter;
}
.has-error .control-label,
.has-error label.label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline,
.has-error.radio label,
.has-error.checkbox label,
.has-error.radio-inline label,
.has-error.checkbox-inline label {
    color: @error-color;
}
.has-error .form-control {
    border-color: @error-color;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-error .form-control:focus {
    border-color: @error-color;
}

.has-error .label:focus {
    border-color: @accent-color;
}

.has-error .input-group-addon {
    color: @error-color;
    border-color: @error-color;
    background-color: #f2dede;
}
.has-error .form-control-feedback {
    color: @error-color;
}
<form class="ajax-form contact-form">
    <h3>Request Contact</h3>
    <div class="form-group form-group-radio">
        <input id="request-call" class="type-radio js-request-call" type="radio" name="type"
               value="call" checked>
        <label class="radio-label" for="request-call">Request call</label>
        <input id="send-email" class="type-radio js-send-email" type="radio" name="type"
               value="email">
        <label class="radio-label" for="send-email">Send E-mail</label>
    </div>
    <div class="form-group">
        <label class="label">Name</label>
        <input id="name" class="form-control" type="text" name="name" placeholder="Enter your name">
    </div>
    <div class="form-group email">
        <label class="label">Email</label>
        <input id="email" class="form-control" type="email" name="email" placeholder="Enter your e-mail">
    </div>
    <div class="form-group phone">
        <label class="label">Phone</label>
        <input id="phone" class="form-control" type="tel" name="phone" placeholder="Enter your phone">
    </div>
    <div class="form-group phone lbl">
        <label class="label">Best time to call</label>
        <select id="time" class="form-control select2-select" name="time">
            <option value="choice" selected>Select best time</option>
            <option value="morning">Morning</option>
            <option value="afternoon">Afternoon</option>
            <option value="evening">Evening</option>
        </select>
    </div>
    <div class="form-group">
        <label class="label">Message</label>
        <textarea id="message" class="form-control" name="message" placeholder="Enter your message"></textarea>
    </div>
    <button class="btn btn-default btn-form" type="submit" id="submitBtn">Submit</button>
    <p class="result" style="display: none;"></p>
</form>
//form
$('.js-request-call').change(function () {
    $(this).closest('form').find('.email').hide();
    $(this).closest('form').find('.phone').show();
});
$('.js-send-email').change(function () {
    $(this).closest('form').find('.email').show();
    $(this).closest('form').find('.phone').hide();
});