const DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', ($scope) => {
$scope.date = new Date(1981, 5, 3);
$scope.validateClick = function (e) {
const result = e.validationGroup.validate();
if (result.isValid) {
DevExpress.ui.notify('The task was saved successfully.', 'success');
} else {
DevExpress.ui.notify('The task was not saved. Please check if all fields are valid.', 'error');
}
};
$scope.stylingMode = 'filled';
$scope.labelMode = 'static';
$scope.phoneRules = { X: /[02-9]/ };
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/23.1.5/css/dx.light.css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script>
<script src="https://cdn3.devexpress.com/jslib/23.1.5/js/dx.all.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
<script src="data.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container" ng-app="DemoApp" ng-controller="DemoController">
<div class="title">Edit Profile</div>
<div class="editors">
<div class="editors-container">
<div class="left">
<div
dx-text-box="{
value: 'Olivia Peyton',
width: '100%',
placeholder: 'Type...',
label: 'Name',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
<div
dx-text-box="{
width: '100%',
placeholder: 'Type...',
label: 'Address',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
</div>
<div class="right">
<div
dx-date-box="{
value: date,
width: '100%',
placeholder: 'Select...',
label: 'Birth Date',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
<div
dx-select-box="{
items: states,
width: '100%',
placeholder: 'Select...',
label: 'State',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
</div>
</div>
<div class="center">
<div
dx-tag-box="{
items: positions,
value: [ 'Support Manager' ],
multiline: false,
width: '100%',
placeholder: 'Select...',
label: 'Position',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
</div>
<div class="editors-container">
<div class="left">
<div
dx-text-box="{
width: '100%',
label: 'Phone',
mask: '+1 (000) 000-0000',
maskRules: phoneRules,
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
</div>
<div class="right">
<div
dx-date-box="{
width: '100%',
placeholder: 'Select...',
label: 'Hire Date',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
dx-validator="{
validationRules: [{
type: 'required'
}]
}"
></div>
</div>
</div>
<div class="center">
<div
dx-text-area="{
value: 'Olivia loves to sell. She has been selling DevAV products since 2012.',
width: '100%',
placeholder: 'Type...',
label: 'Notes',
bindingOptions: {
stylingMode: 'stylingMode',
labelMode: 'labelMode'
}
}"
></div>
</div>
<div class="center">
<div
dx-button="{
text: 'Save',
type: 'default',
onClick: validateClick
}"
class="validate"
></div>
</div>
</div>
<div class="options">
<div class="caption">Options</div>
<div class="option">
<label>Styling Mode</label>
<div
dx-select-box="{
items: [ 'filled', 'outlined', 'underlined' ],
bindingOptions: {
stylingMode: 'stylingMode',
value: 'stylingMode'
}
}"
></div>
</div>
<div class="option">
<label>Label Mode</label>
<div
dx-select-box="{
items: [ 'static', 'floating', 'hidden' ],
bindingOptions: {
stylingMode: 'stylingMode',
value: 'labelMode'
}
}"
></div>
</div>
</div>
</div>
</body>
</html>
.title {
padding: 20px 0 20px 0;
font-size: 18px;
font-weight: 500;
}
.editors {
margin-right: 320px;
height: 570px;
}
.editors .left {
padding: 0 10px 0 0;
}
.editors .right {
padding: 0 0 0 10px;
}
.editors .left,
.editors .right {
flex-grow: 1;
}
.editors .left > div,
.editors .right > div,
.editors .center > div {
margin-bottom: 20px;
}
.editors .center {
padding: 0 27px 0 0;
}
.validate {
float: right;
}
.options {
padding: 20px;
position: absolute;
bottom: 0;
right: 0;
width: 260px;
top: 0;
background-color: rgba(191, 191, 191, 0.15);
}
.caption {
font-size: 18px;
font-weight: 500;
}
.option {
margin-top: 20px;
}
.editors-container {
display: flex;
align-items: center;
justify-content: space-between;
padding-right: 27px;
}
const positions = [
'HR Manager',
'IT Manager',
'CEO',
'Controller',
'Sales Manager',
'Support Manager',
'Shipping Manager',
];
const states = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'];