import React from 'react'; import ReactDOM from 'react-dom'; import JqxExpander from '../../../jqwidgets-react/react_jqxexpander.js'; import JqxValidator from '../../../jqwidgets-react/react_jqxvalidator.js'; import JqxInput from '../../../jqwidgets-react/react_jqxinput.js'; import JqxPasswordInput from '../../../jqwidgets-react/react_jqxpasswordinput.js'; import JqxMaskedInput from '../../../jqwidgets-react/react_jqxmaskedinput.js'; import JqxDateTimeInput from '../../../jqwidgets-react/react_jqxdatetimeinput.js'; import JqxCheckBox from '../../../jqwidgets-react/react_jqxcheckbox.js'; import JqxButton from '../../../jqwidgets-react/react_jqxbuttons.js'; class App extends React.Component { componentDidMount() { this.refs.SendButton.on('click', (event) => { this.refs.myValidator.validate(document.getElementById('form')); }); } render () { let rules = [ { input: '.userInput', message: 'Username is required!', action: 'keyup, blur', rule: 'required' }, { input: '.userInput', message: 'Your username must be between 3 and 12 characters!', action: 'keyup, blur', rule: 'length=3,12' }, { input: '.realNameInput', message: 'Real Name is required!', action: 'keyup, blur', rule: 'required' }, { input: '.realNameInput', message: 'Your real name must contain only letters!', action: 'keyup', rule: 'notNumber' }, { input: '.realNameInput', message: 'Your real name must be between 3 and 12 characters!', action: 'keyup', rule: 'length=3,12' }, { input: '.birthInput', message: 'Your birth date must be between 1/1/1900 and 1/1/2014.', action: 'valueChanged', rule: (input, commit) => { let date = this.refs.dateTimeInput.value(); let result = date.getFullYear() >= 1900 && date.getFullYear() <= 2014; return result; } }, { input: '.passwordInput', message: 'Password is required!', action: 'keyup, blur', rule: 'required' }, { input: '.passwordInput', message: 'Your password must be between 4 and 12 characters!', action: 'keyup, blur', rule: 'length=4,12' }, { input: '.passwordConfirmInput', message: 'Password is required!', action: 'keyup, blur', rule: 'required' }, { input: '.passwordConfirmInput', message: 'Passwords doesn\'t match!', action: 'keyup, focus', rule: (input, commit) => { if (this.refs.passwordInput.val() === this.refs.confirmPasswordInput.val()) { return true; } return false; } }, { input: '.emailInput', message: 'E-mail is required!', action: 'keyup, blur', rule: 'required' }, { input: '.emailInput', message: 'Invalid e-mail!', action: 'keyup', rule: 'email' }, { input: '.ssnInput', message: 'Invalid SSN!', action: 'valuechanged, blur', rule: 'ssn' }, { input: '.phoneInput', message: 'Invalid phone number!', action: 'valuechanged, blur', rule: 'phone' }, { input: '.zipInput', message: 'Invalid zip code!', action: 'valuechanged, blur', rule: 'zipCode' }, { input: '.acceptCheckBox', message: 'You have to accept the terms', action: 'change', rule: 'required', position: 'right:170,0' } ] return (

Register

Username:
Password:
Confirm password:
Real name:
Birth date:
E-mail:
SSN:
Phone:
Zip code:
) } } ReactDOM.render(, document.getElementById('app'));