NumberEdit.Value

Syntax

Value: Number;

Description

The Value property sets numeric value for the component.

Comments

The property value is set in the NumberEdit constructor or using the setValue method. The property value is returned using the getValue method.

If property value is not defined, the editor box shows the value 0. If the value 0 does not fall into the range between minimum and maximum value, the nearest valid value is set into the input line. When the component loses focus, the minimum acceptable value is set.

If the value has several decimal places, the number is rounded on using the getValue method depending on the specified value of the NumberEdit.FractionCount property. To get the specified number without rounding, use the NumberEdit.getUnroundValue method.

Example

Before executing the example study recommendations for code writing.

To create a numeric value editor, use the HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>NumberEdit</title>
    <script src="../build/PP.js" type="text/javascript"></script>
    <link href="../build/PP.css" rel="stylesheet" type="text/css" />
 
    <script text="text/javascript">
        function Ready()   {
            // Create an instance of the NumberEdit component
            NE = new PP.Ui.NumberEdit({
                ParentNode: document.getElementById("NE"), // identifier contained in the div tag
                Width: "170px", // component width
                Height: "21px", // component height
                Value: "5.468953", // component value
                FractionCount: 4,// number of decimal places
            });
            // Display rounded and unrounded component values in the console
            console.log(NE.getValue());
            console.log(NE.getUnroundValue());
        };
    </script>
</head>
<body onload="Ready()">
    <div id="NE"></div>
</body>
</html>

After executing the example a value editor with predefined value is placed to the HTML page:

The console displays the rounded and unrounded component values:

5.469

5.468953

See also:

NumberEdit