Results 1 to 3 of 3

Thread: Scroll to invalid field

  1. #1
    Sencha User
    Join Date
    Jun 2017
    Posts
    13

    Default Scroll to invalid field

    Hi,
    I have a big form with many fields, I scroll to the invalid field as shown in my code below. But this works only for the fields on top. The code does not scroll if the field was half way the page.

    Code:
    var mainForm = this.getView();
    mainForm.getForm().getFields().each(function(field, index, length) {    if (!field.isValid()) {
            field.focus();
            mainForm.setScrollY(field.getPosition()[1], true);
            return false;
        }
        return true;
    });
    Note: Some fields when I debug in chrome have position both x and y set to zero. I am thinking maybe this is why I can't scroll to them.

  2. #2

    Default

    Hi Bbaale,

    make a simple fiddle and describe the expected behaviour if (a. the first invalid field is on top, (b.the first invalid field is out of visibility in the screen, (c..n numerous invalid fields which needs to be processed each..., and so on. Think we can help you after some more explanation.


  3. #3
    Sencha Premium Member tjstuart's Avatar
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    457
    Answers
    4

    Default

    Try the scrollIntoView() method eg.

    myForm.getScrollable().scrollIntoView(myField.getEl());

    http://docs.sencha.com/extjs/6.2.1/c...scrollIntoView

Similar Threads

  1. Replies: 2
    Last Post: 30 Aug 2013, 5:55 AM
  2. Fields in Composite Field Show Scroll Bar When Invalid
    By zacware in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 28 Jun 2010, 10:56 AM
  3. label is scroll with scrollbar,but the field is not scroll
    By edisundong in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Jan 2008, 3:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •