Ticket T343689
Visible to All Users

How to get a value of an editor in dxForm

created 9 years ago

I have received your software update version 15.2.5.16036 in connection with a hotfix.
So far, I could read a value from a Simple Item in dxForm as follows:
var id = '#' + element.dataField;
var data = $(id).val();

Now there is a GUID value in front of the field name in the id = "…" in the generated html.
I can see how I can update the values of a Simple Item in dxForm, but I do not see how I can read it on the fly. because I do not know the GUID value.
Can you help me?

Answers approved by DevExpress Support

created 9 years ago (modified 9 years ago)

Hi Jan,

Use the dxForm.getEditor method to get an editor instance associated with the specified formData field. Then, you will be able to get an editor value using the following code:

JavaScript
var editorValue = formInstance.getEditor('editorFieldName').option('value');

If this does not help, describe your idea in greater detail. We will do our best to assist you.

    Show previous comments (2)
    DevExpress Support Team 9 years ago

      Jan,

      If you set the visible option of an item to false, you cannot use the getEditor method, because the form does not render an editor in this case. If you wish to get a value associated with an invisible item, use the dxForm.formData option.

        Hi Nicolai,

        I have config dxForm like this:
        $scope.contactForm = {
                                 item: [{
             data

        JavaScript
        [JScript] $scope.contactForm = { colCount: 2, items: [{ itemType: "group", caption: "Contact Detail", items: [{ dataField: "Mobile Number", editorOptions: { mask: "+84 (X000) 000-0000", maskRules: { "X": /[02-9]/ } } }, { dataField: "Email", editorOptions: { disabled: false }, }] }] };
        JavaScript
        Then I typing in Email field. How can I get value or (text) in that field?
        DevExpress Support Team 9 years ago

          Hello Jack,

          To process your post more efficiently, I created a separate ticket on your behalf: T349939: dxForm - How to get field value. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.