Announcement

Collapse
No announcement yet.

Max length not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Max length not working

    Max length for first name not working in contacts.

    Please help.

    Thanks.

  • #2
    More details, please

    Comment


    • #3
      Hi,

      Click image for larger version

Name:	contacts.png
Views:	466
Size:	13.0 KB
ID:	31381Click image for larger version

Name:	firstname.png
Views:	455
Size:	31.2 KB
ID:	31382

      I put first name max length as 2. But still I can enter more than 2 characters in firstname.

      Comment


      • #4
        Hi Tanya, Can you help please, regarding the max length issue

        Comment


        • #5
          Hello

          This parameter is used only in database > table > column > length definition (and it affects only, if value is gather, then set ). No UI validation.

          Comment


          • #6
            Hi tanya,

            In case of all other fields, if we set max length parameter, it limits the number of entries in the UI. So is there any way we can do it for first name,last name, phone also?

            Comment


            • #7
              Sorry
              I found this in code
              open client/res/templates/fields/base/edit.tpl, copy {{#if params.maxLength}} maxlength="{{params.maxLength}}"{{/if}} to
              client/res/templates/fields/person-name/edit.tpl in input attribute section

              Thanks

              Comment


              • #8
                Still not working. :-(

                Comment


                • tanya
                  tanya commented
                  Editing a comment
                  Did you Clear Local Cache?

              • #9
                Yes I did

                Comment


                • #10
                  trl code
                  Code:
                  <div class="row">
                      <div class="col-sm-3 col-xs-3">
                          <select name="salutation{{ucName}}" class="form-control">
                              {{options salutationOptions salutationValue field='salutationName' scope=scope}}
                          </select>
                      </div>
                      <div class="col-sm-4 col-xs-4">
                          <input type="text" class="form-control" name="first{{ucName}}" value="{{firstValue}}" placeholder="{{translate 'First Name'}}" {{#if firstMaxLength}} maxlength="{{firstMaxLength}}"{{/if}}>
                      </div>
                      <div class="col-sm-5 col-xs-5">
                          <input type="text" class="form-control" name="last{{ucName}}" value="{{lastValue}}" placeholder="{{translate 'Last Name'}}" {{#if lastMaxLength}} maxlength="{{lastMaxLength}}"{{/if}}>
                      </div>
                  </div>
                  client/src/views/fields/person-name.js
                  data function
                  Code:
                         
                  data: function () {
                              var data = Dep.prototype.data.call(this);
                              data.ucName = Espo.Utils.upperCaseFirst(this.name);
                              data.salutationValue = this.model.get(this.salutationField);
                              data.firstValue = this.model.get(this.firstField);
                              data.lastValue = this.model.get(this.lastField);
                              data.salutationOptions = this.model.getFieldParam(this.salutationField, 'options');
                              data.firstMaxLength = this.model.getFieldParam(this.firstField, 'maxLength');
                              data.lastMaxLength = this.model.getFieldParam(this.lastField, 'maxLength');
                              return data;
                          },

                  Comment


                  • #11
                    Great tanya. It worked . Thank you

                    Comment

                    Working...
                    X