How do i apply validation in widget level when datatype is Date?data

Hi,


I read below URL for adding an element on the widget:-

https://community.telligent.com/community/9/w/developer-training/52490/supporting-configuration

But didn't get a solution for my query. 

Whenever I open and save widget without entering a date. It saved widget without a date. My requirement is when a user selects start date then the event should occur on DOM otherwise it shouldn't show. Date can't empty. It should always check date if it is visible.
I applied few things which are below:-

<property use="required" pattern="\d{1,2}/\d{1,2}/\d{4}" id="startdate"  dataType="date" resourceName="CF_Start_Date" value="start_date" />

Parents Reply
  • Yes, you'd check if you're in preview mode and render an error vs. not rendering if the configuration is invalid and the widget is being shown outside of preview mode:

    #set($isValid = false)
    ## TODO: Identify if the configuration data is valid:
    
    #if (!$isValid)
        #if ($core_v2_widget.IsInWidgetPreviewMode)
            <div class="message error">
                Error message here. This will only be shown in preview mode when someone is editing this widget.
            </div>
        #else
            ## the configuration is invalid, but we're rendering to an end-user so let's just hide the widget.
            $core_v2_widget.Hide()
        #end
    #else
        ## TODO: Valid configuration, so let's render the widget...
    #end

Children
No Data