Your search did not match any results.
Form

Overview

Documentation
The Form widget allows you to visually represent and edit data stored in an object. The widget binds each layout item to a specific field in an existing data object. To display a simple form, you can assign the required object to the formData option. With the Form widget, you can specify the location of labels against corresponding editors and number of columns used in the form layout. Optionally, the widget can determine the column count based on current form width (adaptive rendering).
Copy to Codepen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.showColon = true; $scope.data = companies[0]; $scope.readOnly = false; $scope.labelLocation = "top"; $scope.minColWidth = 300; $scope.colCount = 2; $scope.widthValue = undefined; $scope.formOptions = { bindingOptions: { formData: "data", readOnly: "readOnly", showColonAfterLabel: "showColon", labelLocation: "labelLocation", minColWidth: "minColWidth", colCount: "colCount", width: "widthValue" } }; $scope.selectCompanyOptions = { displayExpr: "CompanyName", dataSource: companies, bindingOptions: { value: "data" } }; $scope.readOnlyOptions = { text: "readOnly", bindingOptions: { value: "readOnly" } }; $scope.showColonOptions = { text: "showColonAfterLabel", bindingOptions: { value: "showColon" } }; $scope.labelLocationOptions = { items: ["left", "top"], bindingOptions: { value: "labelLocation" } }; $scope.minColWidthOptions = { items: [150, 200, 300], bindingOptions: { value: "minColWidth" } }; $scope.colCountOptions = { items: ["auto", 1, 2, 3], bindingOptions: { value: "colCount" } }; $scope.widthOptions = { max: 550, bindingOptions: { value: "widthValue" } }; });
<!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="js/jquery-3.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.light.css" /> <link rel="dx-theme" data-theme="android5.light" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.android5.light.css" /> <link rel="dx-theme" data-theme="ios7.default" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.ios7.default.css" /> <link rel="dx-theme" data-theme="win10.black" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.win10.black.css" /> <link rel="dx-theme" data-theme="win10.white" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.win10.white.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/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/16.2.6/js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div id="form-demo"> <div class="form-container"> <div>Select company:</div> <div dx-select-box="selectCompanyOptions"></div> <div id="form" dx-form="formOptions"></div> </div> <div class="options"> <h4>Form Options</h4> <div> <div>Label location:</div> <div dx-select-box="labelLocationOptions"></div> </div> <div> <div>Columns count:</div> <div dx-select-box="colCountOptions"></div> </div> <div> <div>Min column width:</div> <div dx-select-box="minColWidthOptions"></div> </div> <div> <div>Form width:</div> <div dx-number-box="widthOptions"></div> </div> <div> <div dx-check-box="readOnlyOptions"></div> </div> <div> <div dx-check-box="showColonOptions"></div> </div> </div> </div> </div> </body> </html>
#form-demo { margin: 10px; text-align: center; } #form-demo > div { text-align: left; } .options { display: inline-block; vertical-align: top; width: 200px; margin-left: 20px; } .options > div { margin-top: 25px; } .form-container { display: inline-block; width: 100%; max-width: 550px; } #form { margin-top: 25px; max-width: 550px; min-width: 300px; }
var companies = [{ "ID": 1, "CompanyName": "Super Mart of the West", "Address": "702 SW 8th Street", "City": "Bentonville", "State": "Arkansas", "Zipcode": 72716, "Phone": "(800) 555-2797", "Fax": "(800) 555-2171", "Website": "http://www.nowebsitesupermart.com" }, { "ID": 2, "CompanyName": "Electronics Depot", "Address": "2455 Paces Ferry Road NW", "City": "Atlanta", "State": "Georgia", "Zipcode": 30339, "Phone": "(800) 595-3232", "Fax": "(800) 595-3231", "Website": "http://www.nowebsitedepot.com" }, { "ID": 3, "CompanyName": "K&S Music", "Address": "1000 Nicllet Mall", "City": "Minneapolis", "State": "Minnesota", "Zipcode": 55403, "Phone": "(612) 304-6073", "Fax": "(612) 304-6074", "Website": "http://www.nowebsitemusic.com" }, { "ID": 4, "CompanyName": "Tom's Club", "Address": "999 Lake Drive", "City": "Issaquah", "State": "Washington", "Zipcode": 98027, "Phone": "(800) 955-2292", "Fax": "(800) 955-2293", "Website": "http://www.nowebsitetomsclub.com" }];