Cell loses focus even though the field value is invalid

Cell loses focus even though the field value is invalid

FFRFFR Posts: 7Questions: 1Answers: 0
edited July 2019 in Free community support

Hi team,
I have a problem regarding the submission of cells.

I validate the user's input at the preSubmit event and return the result. The user can finish his input by clicking the tab key. The problem is that he loses the focus of the current edited cell even though the input was invalid. Furthermore the current edited field stays visible.

Is there any way to prevent the execution of the implemented tab functionality?

Thanking you in advance,
Fabi

Answers

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Hi Fabi,

    Can you give me a link to the page in question please?

    Thanks,
    Allan

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi allan,
    this is just a local version, so I am not able to send you the page in question. The validation in the preSubmit event looks like that.

    .on('preSubmit', function ( e, o, action ) {
                            if(action !== 'remove'){
                                var title = this.field('title');
    
                                if(!title.isMultiValue()){
                                    if (title.val().length >= title.s.opts.maxLength) {
                                        title.error('maximal input length is: ' + title.s.opts.maxLength);
                                    }
    
                                    if (this.inError()) {
                                        return false;
                                    }
                                }
                            }
    }
    

    After some research and debugging I found out that the _blur function causes that issue (datables.js) which is executed after the preSubmit event (when using the tab key). Is there an option to prevent the execution of that because I want to keep the focus on the edited cell if it's value is invalid.

    Thanking you in advance,
    Fabi

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Hi Fabi,

    Interesting one. I'm not sure we've tried using preSubmit for validation when combined with KeyTable before, since we tend to focus on server-side validaiton (it has to be done there anyway).

    I'll see if we can create a test case here.

    Allan

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi Allan,
    thanks for your quick response. Let me know when you have something.

    Kind regards,
    Fabi

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @FFR

    We've been able to reproduce it, see cut down test case here. I've raised it internally (DD-971 for my reference) and we'll report back here when there's an update.

    Cheers,

    Colin

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi @colin and @allan ,
    I am looking forward to hearing from you soon.

    Cheers,
    Fabi

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi @collin and @allan,
    are there any news on the bug status?

    Cheers,
    Fabi

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @FFR ,

    It's still in the backlog I'm afraid. We're going to look at releases in a few weeks, so we'll have a better idea then of when this would be addressed.

    Cheers,

    Colin

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi @colin,
    thank you for your quick response. I am looking forward to hearing from you soon.

    Cheers,
    Fabi

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Hi Fabi,

    Fixed here. It will be in the nightly build shortly.

    Regards,
    Allan

  • FFRFFR Posts: 7Questions: 1Answers: 0

    Hi @allan, hi @collin,
    thank you for your quick help.

    Kind regards,
    Fabi

This discussion has been closed.