Javascript Forms
Forms for Javascript
Forms for Javascript
Forms for Javascript
Learn about Forms
Form components you’ll need for building great looking mobile and desktop apps. Shipping 15 distinct elements ranging from inputs to layout helpers.
With useful features for a refined UX, including the following elements:
- Single and multiline text
- Select styling
- Buttons
- Segmented control
- Checkbox and checklist
- Radio buttons
- Switch
- Rating
- Stepper
- Page & typography
- Slider
- Progress
- Alerts
- Notifications
- Notes
Forms demos available for other frameworks.
Viewing demos & code for
Forms - Mobile form
<div mbsc-form>
<div class="mbsc-form-group">
<div class="mbsc-form-group-title">User Data</div>
<label for="firstname">
First Name
<input id="firstname" type="text" placeholder="First Name" />
</label>
<label for="lastname">
Last Name
<input id="lastname" type="text" placeholder="Last Name" />
</label>
<label for="username">
User Name
<input id="username" type="text" placeholder="User Name" />
</label>
<label for="company">
Company
<input id="company" type="text" placeholder="Company Name" />
</label>
<label for="email">
Email
<input id="email" type="text" placeholder="Email Address" />
</label>
</div>
<div class="mbsc-form-group">
<div class="mbsc-form-group-title">Phone Number</div>
<label for="home">
Home
<input id="home" type="text" placeholder="Home" />
</label>
<label for="business">
Business
<input id="business" type="text" placeholder="Business" />
</label>
<label for="fax">
Fax
<input id="fax" type="text" placeholder="Fax" />
</label>
</div>
</div>
Forms - Desktop form
mobiscroll.form('#demo-desktop-columns', {
theme: '',
lang: '',
inputStyle: 'box',
labelStyle: 'floating'
});
<div id="demo-desktop-columns">
<div class="mbsc-grid mbsc-grid-fixed">
<div class="mbsc-form-group">
<div class="mbsc-row mbsc-justify-content-center">
<div class="mbsc-col-md-10 mbsc-col-xl-8 mbsc-form-grid">
<div class="mbsc-form-group-title">Multi column grid</div>
<div class="mbsc-row">
<div class="mbsc-col-md-6 mbsc-col-12">
<div>
<label for="email">Email</label>
<input id="email" type="text" placeholder="Email" />
</div>
</div>
<div class="mbsc-col-md-6 mbsc-col-12">
<div>
<label for="pass">Password</label>
<input id="pass" type="password" placeholder="Password" data-password-toggle="true" />
</div>
</div>
</div>
<div class="mbsc-row">
<div class="mbsc-col-12">
<div>
<label for="address">Address</label>
<input id="address" type="text" placeholder="Address" />
</div>
</div>
</div>
<div class="mbsc-row">
<div class="mbsc-col-md-6 mbsc-col-12">
<div>
<label for="city">City</label>
<input id="city" type="text" placeholder="City" />
</div>
</div>
<div class="mbsc-col-md-4 mbsc-col-6">
<div>
<label for="state">State</label>
<select id="state">
<option value="Alabama">Alabama</option>
<option value="Alaska">Alaska</option>
<option value="Arizona">Arizona</option>
<option value="Arkansas">Arkansas</option>
<option value="California">California</option>
<option value="Colorado">Colorado</option>
<option value="Connecticut">Connecticut</option>
<option value="Delaware">Delaware</option>
<option value="Florida">Florida</option>
<option value="Georgia">Georgia</option>
<option value="Hawaii">Hawaii</option>
<option value="Idaho">Idaho</option>
<option value="Illinois Indiana">Illinois Indiana</option>
<option value="Iowa">Iowa</option>
<option value="Kansas">Kansas</option>
<option value="Kentucky">Kentucky</option>
<option value="Louisiana">Louisiana</option>
<option value="Maine">Maine</option>
<option value="Maryland">Maryland</option>
<option value="Massachusetts">Massachusetts</option>
<option value="Michigan">Michigan</option>
<option value="Minnesota">Minnesota</option>
<option value="Mississippi">Mississippi</option>
<option value="Missouri">Missouri</option>
<option value="Montana Nebraska">Montana Nebraska</option>
<option value="Nevada">Nevada</option>
<option value="New Hampshire">New Hampshire</option>
<option value="New Jersey">New Jersey</option>
<option value="New Mexico">New Mexico</option>
<option value="New York">New York</option>
<option value="North Carolina">North Carolina</option>
<option value="North Dakota">North Dakota</option>
<option value="Ohio">Ohio</option>
<option value="Oklahoma">Oklahoma</option>
<option value="Oregon">Oregon</option>
<option value="Pennsylvania Rhode Island">Pennsylvania Rhode Island</option>
<option value="South Carolina">South Carolina</option>
<option value="South Dakota">South Dakota</option>
<option value="Tennessee">Tennessee</option>
<option value="Texas">Texas</option>
<option value="Utah">Utah</option>
<option value="Vermont">Vermont</option>
<option value="Virginia">Virginia</option>
<option value="Washington">Washington</option>
<option value="West Virginia">West Virginia</option>
<option value="Wisconsin">Wisconsin</option>
<option value="Wyomin">Wyomin</option>
</select>
</div>
</div>
<div class="mbsc-col-md-2 mbsc-col-6">
<div>
<label for="zip">Zip</label>
<input id="zip" type="text" placeholder="Zip" />
</div>
</div>
</div>
<button>Sign in</button>
</div>
</div>
</div>
</div>
</div>
<div mbsc-form>
<div class="mbsc-grid">
<div class="mbsc-row mbsc-justify-content-center">
<div class="mbsc-col-sm-9 mbsc-col-md-7 mbsc-col-xl-5">
<div class="mbsc-form-group-inset">
<div class="mbsc-form-group-title">Single column grid</div>
<label for="firstname">
First Name
<input id="firstname" type="text" placeholder="First Name" />
</label>
<label for="lastname">
Last Name
<input id="lastname" type="text" placeholder="Last Name" />
</label>
<label for="username">
User Name
<input id="username" type="text" placeholder="User Name" />
</label>
<label for="company">
Company
<input id="company" type="text" placeholder="Company Name" />
</label>
<label for="email-address">
Email
<input id="email-address" type="text" placeholder="Email Address" />
</label>
</div>
</div>
</div>
</div>
</div>
Forms - Validation
mobiscroll.settings = {
lang: '',
theme: ''
};
var form = document.getElementById("demo"),
addedToFields = false;
form.noValidate = true;
form.onsubmit = validateForm;
function validateForm(event) {
event.preventDefault();
var f,
formvalid = true;
for (f = 0; f < form.elements.length; f++) {
var field = form.elements[f],
name = field.name.charAt(0).toUpperCase() + field.name.slice(1),
parent = field.parentNode,
errorMsg = parent.querySelector('.mbsc-err-msg');
if (name && field.validity.valid) {
parent.parentNode.classList.remove('mbsc-err');
if (errorMsg) {
parent.removeChild(errorMsg);
}
} else if (name) {
if (!errorMsg) {
errorMsg = document.createElement('span');
errorMsg.className = 'mbsc-err-msg';
parent.appendChild(errorMsg);
}
var firstError = null;
for (var key in field.validity) {
if (!firstError && key !== 'valid' && field.validity[key]) {
firstError = key;
}
}
switch (firstError) {
case 'tooShort':
{
errorMsg.innerHTML = name + ' is too short';
break;
}
case 'typeMismatch':
{
errorMsg.innerHTML = name + ' is invalid';
break;
}
case 'valueMissing':
default:
{
errorMsg.innerHTML = name + ' is required';
break;
}
}
if (name === 'Bio' && firstError === 'tooShort') {
errorMsg.innerHTML = "Don't be shy, surely you can tell more";
}
parent.parentNode.classList.add('mbsc-err');
formvalid = false;
}
if (!addedToFields) {
//field.onchange = validateForm;
field.oninput = validateForm;
}
}
if (formvalid && event.type === 'submit') {
mobiscroll.alert({
title: 'Thank you for registering',
message: 'You have successfully signed up as a user!'
});
} else if (!addedToFields) {
addedToFields = true;
}
return formvalid;
}
<form mbsc-form id="demo">
<div class="mbsc-form-group">
<div class="mbsc-form-group-title">Sign Up</div>
<label>
<input name="username" type="text" placeholder="Username" minlength="2" required data-icon="user4">
</label>
<label>
<input name="email" type="email" placeholder="Email" required data-icon="ion-ios7-email">
</label>
<label>
<input name="password" type="password" placeholder="Password" minlength="6" required data-icon="lock2" data-password-toggle="true">
</label>
<label>
<select id="gender" name="gender" required data-icon="user4">
<option value="">Please select</option>
<option value="female">Female</option>
<option value="male">Male</option>
</select>
</label>
<label>
<textarea name="bio" placeholder="About me" required minlength="20" data-icon="line-note"></textarea>
</label>
</div>
<div class="mbsc-form-group mbsc-btn-group-block">
<button id="md-success" data-icon="checkmark" type="submit">Sign Up</button>
</div>
</form>
Forms - Create account
<div id="demo" class="md-create-account" mbsc-form>
<div class="md-chart-pic"></div>
<div class="md-cac-title mbsc-padding">
<h4>Great news, your traffic <br> is already being tracked</h4>
<h4>Continue by creating a new account</h4>
</div>
<div class="md-cac-cont">
<div class="mbsc-form-group-inset">
<label>
<input name="username" type="text" placeholder="Name">
</label>
<label>
<input name="email" type="email" placeholder="Email address">
</label>
<label>
<input name="password" type="text" placeholder="Password" data-password-toggle="true">
</label>
</div>
<div class="md-cac-btn mbsc-form-group-inset">
<button class="mbsc-btn-block" type="submit">Create account</button>
<button class="mbsc-btn-flat mbsc-btn-block"> I'll do it later</button>
</div>
</div>
</div>
.md-create-account {
padding: 0 !important;
}
.md-create-account .md-cac-title {
text-align: center;
padding-bottom: 3em;
}
.md-create-account .md-cac-title,
.md-create-account .md-cac-cont {
padding-top: 0;
}
.md-create-account .md-cac-cont {
padding-bottom: 0;
}
.md-create-account .md-chart-pic {
background-image: url("/content/img/demos/chart@1x.png");
height: 150px;
background-repeat: no-repeat;
background-position: center;
}
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 144dpi) {
.md-create-account .md-chart-pic {
background: url("/Content/img/demos/chart@2x.png") no-repeat center 12px;
background-size: 109px 81px;
background-position: center;
}
}
.md-phone-num .mbsc-np-dsp {
min-height: 25px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
Forms - Sign up
// Use the settings object to change the theme
mobiscroll.settings = {
lang: '',
theme: ''
};
var form = document.getElementById("demo");
form.noValidate = true;
form.onsubmit = validateForm;
function validateForm(event) {
event.preventDefault();
var parent,
errorMsg,
form = (event.target ? event.target : event.srcElement),
f, field, formvalid = true;
for (f = 0; f < form.elements.length; f++) {
field = form.elements[f];
parent = field.parentNode;
errorMsg = parent.querySelector('.mbsc-err-msg');
if (field.validity.valid) {
parent.parentNode.classList.remove('mbsc-err');
if (errorMsg) {
parent.removeChild(errorMsg);
}
} else {
if (!errorMsg) {
errorMsg = document.createElement('span');
errorMsg.className = 'mbsc-err-msg';
errorMsg.innerHTML = field.name == 'password' ? 'Invalid, please see rules' : 'This field is required';
parent.appendChild(errorMsg);
}
parent.parentNode.classList.add('mbsc-err');
formvalid = false;
}
}
return formvalid;
}
<form id="demo" class="md-signup-rules" ng-non-bindable mbsc-form>
<div class="mbsc-form-group-inset">
<div class="mbsc-form-group-title">Sign Up</div>
<label>
<input name="username" type="text" placeholder="Name" minlength="4" required>
</label>
<label>
<input name="email" type="email" placeholder="Email" required>
</label>
<label>
<input id="password" name="password" type="text" placeholder="Password" data-password-toggle="true" pattern="(?=.*[a-z])(?=.*[A-Z]).{6,}" required>
</label>
</div>
<div class="mbsc-form-group-inset">
<div class="mbsc-padding">
<h6>Use lowercase and uppercase characters </h6>
<h6>Length of password should be at least 6 characters</h6>
</div>
<div class="mbsc-padding">
<button class="mbsc-btn-block" type="submit">Sign Up</button>
</div>
</div>
</form>
Forms - Log in
// Use the settings object to change the theme
mobiscroll.settings = {
lang: '',
theme: ''
};
var isLogin = false;
document
.querySelector('.md-signup')
.addEventListener('click', function (ev) {
ev.preventDefault();
document.querySelector('.md-signup-btn').innerHTML = isLogin ? 'Sign in' : 'Sign up';
this.innerHTML = isLogin ? "Don't have an account yet? Sign up." : "Already have an account?";
isLogin = !isLogin;
})
document
.querySelector('.md-login')
.addEventListener('click', function (ev) {
ev.preventDefault();
});
<div id="demo" class="md-login-form" mbsc-form>
<div class="md-logo micons icon-mbsc-logo"></div>
<div class="mbsc-form-group-inset">
<label>
<input id="email" type="email" name="Email" placeholder="Email" />
</label>
<label>
<input name="password" type="text" placeholder="Password" data-password-toggle="true" data-icon="none" data-icon-align="right" />
</label>
</div>
<div class="mbsc-form-group-inset mbsc-padding mbsc-align-center">
<a href="#" class="md-signup">Don't have an account yet? Sign up.</a>
<br><br>
<a href="#" class="md-login">Forgot password?</a>
</div>
<div class="mbsc-form-group-inset mbsc-padding">
<button class="mbsc-btn-block md-signup-btn">Sign in</button>
</div>
</div>
.md-login-form .md-logo {
display: inline-block;
width: 100%;
font-size: 80px;
text-align: center;
height: 46px;
margin: 130px 0 30px 0;
color: #1c75bc;
}
Looking for something you didn't see or have a sales question?
Ask us about it, we're here to help.
Component license
Purchase component licenses if you are looking for specific funcionality.
All
Framework license
Get all 36 components, including
Framework license
Get all 36 components, including
- Use it when building with plain and simple JS
- Compatible with vanilla JS app or frameworks like Vue
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with jQuery and jQuery Mobile
- Enjoy the familiar API if you already use jQuery
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular JS and Ionic 1
- For web and mobile apps based on Angular 1.x
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular 2/4/5/6/7 and Ionic 2/3/4
- Visual Studio and VS Code integration
- Royalty-free commercial usage
- Technical support is included with the license
- Use it when building with React JS
- Collection of UI components for web and mobile
- Royalty-free commercial usage
- Technical support is included with the license
Framework license
Select the development framework you are using. Get all 36 components with the license.
- Use it when building with plain and simple JS
- Compatible with vanilla JS app or frameworks like Vue
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with jQuery and jQuery Mobile
- Enjoy the familiar API if you already use jQuery
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular JS and Ionic 1
- For web and mobile apps based on Angular 1.x
- Royalty-free commercial usage
- Technical support is included with the license
- Use it with Angular 2/4/5/6/7 and Ionic 2/3/4
- Visual Studio and VS Code integration
- Royalty-free commercial usage
- Technical support is included with the license
- Use it when building with React JS
- Collection of UI components for web and mobile
- Royalty-free commercial usage
- Technical support is included with the license
Select the framework you are interested in
Use Javascript when building with plain and simple JS.
Use jQuery when you have jQuery already included or if you are building with jQuery Mobile.
Use AngularJS when building with Angular 1.x or Ionic 1.
Use Angular when building with Angular 2/4/5/6/7 or Ionic 2/3/4.
Use it when you are building your app or website with React.
Do you need additional support seats?
The framework license comes with one support seat. ( +$50/seat )
Add the source code?
What framework are you using?
We have to set you up with a trial for this to run 👍
What framework are you using?
Step 1.Install the Mobiscroll CLI from npm
$ npm install -g @mobiscroll/cli
The CLI makes configuring your apps super simple 👍
Step 2.Run the following command in the root folder of your Ionic project
$ mobiscroll config ionic
$ mobiscroll config ionic --lite
You will be prompted to log in with your mobiscroll account. Set your password here
Create an Ionic 3 & Mobiscroll starter with the CLI:
Run this command for Ionic 4 & Mobiscroll starter:
Extract the zip file and run the project like any Ionic app. Make sure to have Ionic CLI installed and open the terminal in the app root folder.
$ npm install
$ ionic serve
Let us know if we can help and enjoy!
Your password has been changed!
Everything is set up so that you can dig in right away and start exploring.
Please extract the zip file and simply open the demos in your favorite browser.
For instructions on how to install Mobiscroll in your project
follow this guide.
Let us know if we can help and enjoy!
Please extract the zip file and run the project like any Angular CLI app.
Make sure to have the Angular CLI installed.
For installation and usage, extract the zip file and open a terminal window and follow these steps.
$ npm install
$ ng serve --open
Let us know if we can help and enjoy! 👍
Everything is set up so that you can dig in right away and start exploring.
We have set up a trial so that you can try the demos locally.
The easiest way to get started is to follow the installation steps and by
grabbing the code directly from the demo page. Let us know if we can help and enjoy!
You'll find a fully functional Kitchen-sink Ionic app in the zip file.
The demos are using Babel's in-browser ES6 and JSX transformer.
Please extract the zip file and open the demos in your browser.
For instructions on how to install Mobiscroll in your project
follow this guide.
Let us know if we can help and enjoy!