                   defaultValue  : (new Date().getFullYear())
             address1            :
               label             : "Address"
-              itemClass         : KDInputView
               name              : "address1"
               placeholder       : "Street Name & Number"
+              validate          :
+                rules           :
+                  required      : yes
+                messages        :
+                  required      : "First address field is required!"
             address2            :
               label             : " "
-              itemClass         : KDInputView
               name              : "address2"
               placeholder       : "Apartment/Suite Number"
             city                :
               label             : "City & State"
-              itemClass         : KDInputView
               name              : "city"
               placeholder       : "City Name"
+              validate          :
+                rules           :
+                  required      : yes
+                messages        :
+                  required      : "City is required!"
               nextElementFlat   :
                 state           :
-                  itemClass     : KDInputView
                   name          : "state"
                   placeholder   : "State"
+                  validate      :
+                    rules       :
+                      required  : yes
+                    messages    :
+                      required  : "State is required!"
             zip                 :
               label             : "ZIP & Country"
-              itemClass         : KDInputView
               name              : "zipCode"
               placeholder       : "ZIP Code"
+              validate          :
+                rules           :
+                  required      : yes
+                messages        :
+                  required      : "Zip code is required!"
               nextElementFlat   :
                 country         :
-                  itemClass     : KDInputView
                   name          : "country"
                   placeholder   : "Country"
+                  defaultValue  : "United States of America"
+                  validate      :
+                    rules       :
+                      required  : yes
+                    messages    :
+                      required  : "First address field is required!"
 
   form = modal.modalTabs.forms["Billing Info"]
+
+  form.on "FormValidationFailed", =>
+    form.buttons.Save.hideLoader()
+
   for k, v of data
     if form.inputs[k]
       form.inputs[k].setValue v

createAccountPaymentMethodModal = (data, callback) ->
  modal = new KDModalViewWithForms
    title                       : "Billing Information"
    content                     : ''
    helpContent                 :
      """
      """
    overlay                     : yes
    width                       : 500
    height                      : "auto"
    cssClass                    : "payments-modal"
    tabs                        :
      navigable                 : yes
      goToNextFormOnSubmit      : no
      forms                     :
        "Billing Info"          :
          buttons               :
            Save                :
              title             : "Save"
              style             : "modal-clean-green"
              type              : "submit"
              loader            :
                color           : "#444444"
                diameter        : 12
              callback          : =>
                tabs = modal.modalTabs
                form = tabs.forms["Billing Info"]
                button = form.buttons["Save"]
                onError = ->
                    button.hideLoader()
                onSuccess = ->
                    modal.destroy()
                callback form.getFormData(), onError, onSuccess
          fields                :
            cardFirstName       :
              label             : "Name"
              itemClass         : KDInputView
              name              : "cardFirstName"
              placeholder       : "First Name"
              nextElementFlat   :
                cardLastName    :
                  itemClass     : KDInputView
                  name          : "cardLastName"
                  placeholder   : "Last Name"
            cardNumber          :
              label             : "Card Number"
              itemClass         : KDInputView
              name              : "cardNumber"
              placeholder       : 'Card Number'
              # validate          :
              #   event           : "blur"
              #   rules           : "creditCard"
              nextElementFlat   :
                cardCV          :
                  tooltip       :
                    placement   : 'right'
                    direction   : 'center'
                    title       : 'The location of this verification number depends on the issuer of your credit card'
                  itemClass     : KDInputView
                  name          : "cardCV"
                  placeholder   : "CV Number"
            cardMonth           :
              label             : "Expire Date"
              itemClass         : KDSelectBox

      modal = createAccountPaymentMethodModal data, (newData, onError, onSuccess) ->
        KD.remote.api.JRecurlyPlan.setUserAccount newData, (err, result)->
          if err
            onError err
          else
            controller.emit 'reload'
            onSuccess result

      form = modal.modalTabs.forms["Billing Info"]

