InputMask rawValue

The InputMask's value property returns the full text content of the control, including the user's input and any template characters.

You can use the rawValue property to get or set the control value including only the input characters and excluding any template characters:





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// This file locates: "Scripts/Lesson/C1Input/InputMaskRawValue.js".
c1.documentReady(function () {
    var theSSN = wijmo.Control.getControl('#theSSN');
    var theZip = wijmo.Control.getControl('#theZip');
    var theZip4 = wijmo.Control.getControl('#theZip4');
    var thePhone = wijmo.Control.getControl('#thePhone');
 
    theSSN.valueChanged.addHandler(function (s, e) {
        showRaw(s);
    });
    theZip.valueChanged.addHandler(function (s, e) {
        showRaw(s);
    });
    theZip4.valueChanged.addHandler(function (s, e) {
        showRaw(s);
    });
    thePhone.valueChanged.addHandler(function (s, e) {
        showRaw(s);
    });
 
    function showRaw(s) {
        var el = document.getElementById(s.hostElement.id + 'Raw');
        el.textContent = ' rawValue: ' + s.rawValue;
    }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
using System.Web.Mvc;
 
namespace LearnMvcClient.Controllers
{
    public partial class C1InputController : Controller
    {
        // GET: InputMaskRawValue
        public ActionResult InputMaskRawValue()
        {
            return View();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<h1>
    @Html.Raw(Resources.C1Input.InputMaskRawValue_Title)
</h1>
 
<p>
    @Html.Raw(Resources.C1Input.InputMaskRawValue_Text1)
</p>
<p>
    @Html.Raw(Resources.C1Input.InputMaskRawValue_Text2)
</p>
 
<div class="demo-settings">
    <label for="theSSN">@Html.Raw(Resources.C1Input.InputMaskRawValue_Text3)</label>
    @Html.C1().InputMask().Id("theSSN").Mask("000-00-0000")
    <span id="theSSNRaw"></span><br>
    <label for="theZip">@Html.Raw(Resources.C1Input.InputMaskRawValue_Text4)</label>
    @Html.C1().InputMask().Id("theZip").Mask("00000")
    <span id="theZipRaw"></span><br>
    <label for="theZip4">@Html.Raw(Resources.C1Input.InputMaskRawValue_Text5)</label>
    @Html.C1().InputMask().Id("theZip4").Mask("00000-0000")
    <span id="theZip4Raw"></span><br>
    <label for="thePhone">@Html.Raw(Resources.C1Input.InputMaskRawValue_Text6)</label>
    @Html.C1().InputMask().Id("thePhone").Mask("(999) 000-0000")
    <span id="thePhoneRaw"></span><br>
</div>