• gene shen
    February 26, 2017 at 7:20 pm #3847

    I have a date picker created in a coach view (i.e. aaa cv with control id aaa_cv). The date picker has a date with control id (mydate). This date picker was included in a input group with control id “input_group1”.  Then this coach view was nested in another coach view (bbb cv with control id bbb_cv) which has a OK button. In the inline JS, I created a function called this.validation = function () { }; I would like to use this.ui.get(“aaa_cv/mydate”).getDate() to get the value of the date. It throwed a null pointer exception. I tried this.ui.get(“aaa_cv/input_group1/mydate”).getDate(). It doesn’t work neither. This validation function is called on click of the OK button.

    Do you know how to get the date value for validation? Thanks in advance!

    SPARK Support
    February 27, 2017 at 10:27 am #3863

    Hi Gene,

    When you inspect the control in your configuration, you should be able to see the control-name.  (see screenshot) The control name should indicate the correct full address including any nested Coach Views.

    As you can see from my example, setting dt = page.ui.get() should return some information about the view object if the name is correct.

    Regards,

    Stephen P.

    gene shen
    February 27, 2017 at 6:47 pm #3875

    Hi Stephen,

    Thanks for your reply. I am able to get the date using page.ui.get(“control name”); from the console. However, I am not able to use this.ui.get(“control name”); from inline JavaScript function on behavior tab of a coach view. What I got is “unavailable”. I am able to get the input text on the same coach view. I have been struggled for 3 days on this seemed simple issue.

    Regards,

    Gene

    SPARK Support
    March 1, 2017 at 9:32 am #3893

    Hi Gene,

    I was able to use this code on a coach view:

    this.validation = function(){
    var dt = this.ui.get(“Date_Picker1”);
    console.log(dt.getDate());
    }

    Then, from the console, I can run:

    cv = page.ui.get(“MyCoach1”);

    cv.validation();

    However, I should note that to use this.ui.get(“controlName”), the controls must be placed directly on the underlying coach view.  If you have a nested coach view, you will need to use the full underlying address. (ie: this.ui.get(“/AddressCV1/Street1”)

    Regards,

    Stephen P.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search