How to validate a custom widget?
For a form API element, just set $form['element']['#required'] = TRUE;

More info: #required


  Indicates whether or not the element is required. This
  automatically validates for empty fields, and flags inputs as
  required.


For more control, consider an #element_validate handler

Note, for a custom element using hook_element_info, #validate and #element_validate callback handlers are supported there in the element definition.