     @button = new KDButtonView
       title         : buttonTitle or 'Create account'
       type          : 'submit'
-      style         : "solid green medium"
+      style         : 'solid green medium'
       loader        : yes
       callback      : @bound 'submitForm'
 
     @invitationCode = new LoginInputView
-      cssClass      : "hidden"
+      cssClass      : 'hidden'
       inputOptions  :
-        name        : "inviteCode"
+        name        : 'inviteCode'
         type        : 'hidden'
 
     @domain = new KDCustomHTMLView

          container      : this
          rules          :
            required     : yes
            rangeLength  : [4,25]
            regExp       : /^[a-z\d]+([-][a-z\d]+)*$/i
            usernameCheck: (input, event)=> @usernameCheck input, event
            finalCheck   : (input, event)=> @usernameCheck input, event, 0
          messages       :
            required     : "Please enter a username."
            regExp       : "For username only lowercase letters and numbers are allowed!"
            rangeLength  : "Username should be between 4 and 25 characters!"
          events         :
            required     : "blur"
            rangeLength  : "keyup"
            regExp       : "keyup"
            usernameCheck: "keyup"
            finalCheck   : "blur"
        decorateValidation: no

    {buttonTitle} = @getOptions()

            else
              input.setValidationResult "usernameCheck", null


  getEmailValidator: ->
    container   : this
    event       : 'blur'
    rules       :
      required  : yes
      email     : yes
      available : (input, event) =>
        return if event?.which is 9
        input.setValidationResult 'available', null
        email = input.getValue()
        if input.valid
          # @email.loader.show()
          KD.remote.api.JUser.emailAvailable email, (err, response)=>
            # @email.loader.hide()
            if err then warn err
            else
              if response
                input.setValidationResult "available", null
              else
                input.setValidationResult "available", "Sorry, \"#{email}\" is already in use!"
        return
    messages    :
      required  : 'Please enter your email address.'
      email     : 'That doesn\'t seem like a valid email address.'


  submitForm: (event) ->

    # KDInputView doesn't give clear results with
    # async results that's why we maintain those
    # results manually in EMAIL_VALID and USERNAME_VALID
    # at least for now - SY
    if EMAIL_VALID and USERNAME_VALID and @username.input.valid and @email.input.valid
      @submit event
      return yes
    else
      @button.hideLoader()
      @username.input.validate()
      @email.input.validate()
      return no


  viewAppended:->

    super
