Display error message using a SKUID snippet, editor undefined

edited April 2019 in Questions
I want to display an error message with as below with a skuid snippet,


var $ = skuid.$;
var pageTitle = $('#PersonalDetailsForm');
var editor = pageTitle.data('object').editor;
var PersonalDetailsFormModel = skuid.model.getModel('PersonalDetailsForm');
var PersonalDetailsForm = PersonalDetailsFormModel.getFirstRow();

if (PersonalDetailsForm.Asic_CountryOfBirth__c === 'Australia') {

    editor.handleMessages(
        [{
            message: 'Error message xyz',
            severity: 'ERROR'
        }]
    );

    return false;
}

the "var editor = pageTitle.data('object').editor;" sections gives an error message saying that
"Uncaught TypeError: Cannot read property 'editor' of undefined"

The wired thing here is that the same code snippet worked for some other pages in my system without an error.

Why am I getting this error in my second implementation, I have noticed that there is a model with the same name as the pageTitle "PersonalDetailsForm",
Could this be an issue?

Appreciate your help
thanks.

Comments

  • Rob HatchRob Hatch Skuad, Sonar ✭✭
    edited April 2019
    Are you sure that the ID defined for the page title component on your page is exactly  "PersonalDetailsForm "   Case sensitivity is key here. 
  • edited July 2015
    Rob, Thanks for the help, it was a silly mistake of mine, I've been referring to the "Page name" instead of Page Title -> Advance -> Unique Id.
  • Rob HatchRob Hatch Skuad, Sonar ✭✭
    edited September 2016
    Whew! Glad it was an easy fix.  
  • Prashant SinghPrashant Singh Member ✭✭
    edited April 2019
    Rob i was also facing the same issue thaks for  posting your fix
Sign In or Register to comment.