inline row validation when field changes

inline row validation when field changes

MGBMGB Posts: 2Questions: 2Answers: 0

hi everybody,
I've read one or two posts here making questions about the possibility of entire row validation when a field changes. In my case, what i need is to validate each field onPreSubmit and focus on the input that has the error, making it editable. I've changed the method so that if the changed value is valid, I close the editor instance and open a new one for the invalid field(next field to be validated) , returning false.
But it seems to be useless, it makes a previous submit and then makes the invalid field editable with the error behind.
is there any (better) way to achieve this?

Thanks in advance, guys!

This question has an accepted answers - jump to answer

Answers

  • andyqandyq Posts: 2Questions: 0Answers: 0

    Same here. I have two combos and one of them is dependant. Both are required but when I change the first one, the second gets empty so I can't send the row yet. In the presubmit event if I return false, changes of the first combo are reverted, and if I return true it sends the row. This is what I have right now inside presubmit:

    if (dependentField != null) {
                let dependentValue = this.field(dependentField);
                if (fields[dependentField].validation && fields[dependentField].validation.required == true) {
                    if (!dependentValue.val()) {
    
                        dataEditor.close();
    
                        dependentValue.error(getMessages()["error_message_required"]);
                        reAdjustTable(targetDiv);                       
                        dataEditor.inline( dependent, {
                            scope: 'cell',
                            onBlur: 'submit',
                            submit: 'allIfChanged'
                        })
                         return true;
                    }
                }
            }
    

    Once I'm able to do this I will definetly purchase the license because it seems pretty good to fill my needs. Thanks Allan (or someone else who could help me).

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin
    Answer ✓

    Yes, this is something that Editor is not currently designed to do I'm afraid. Inline editing is suitable for editing a single field (cell) at a time, not multiple. If you need to validate multiple fields at the same time and let the user modify the values of each, then you either need to use the full form, or bubble editing with the fields that might need to be edited shown.

    Multi-cell inline editing is something that we plan to introduce in future.

    Regards,
    Allan

  • TatiniTatini Posts: 1Questions: 0Answers: 0
    edited January 2019

    Hi All ,
    I am using inline validation with jQueryDataTable. If trying to edit multiple field (two columns)at time when error occurs(required error) ,then it is locking the first column(means first row becoming non clickable).I am using makeEditable function with below inline validator.

    oValidationOptions:
                    {
                        rules: {
                            value: {
                                required: true,
                                maxlength: 2000
                            }
                        },
                        messages: {
                            value: {
                                required: "<span style='color:red'>Comments are Required!</span>",
                                maxlength: "<span style='color:red'>Comments should not Exceed 2000 Characters!</span>"
    
                            }
                        }
                    }
                    
                    
    oValidationOptions:
                    {
                        rules: {
                            value: {
                                required: true,
                                min: 0,
                                max: 1000,
                                digits: true
                            }
                        },
                        messages: {
                            value: {
                                required: "<span style='color:red'>Hold Off is Required!</span>",
                                min: "<span style='color:red'>The Hold-Off entered must be in range 0 to 1000!</span>",
                                max: "<span style='color:red'>The Hold-Off entered must be in range 0 to 1000!</span>",
                                digits: "<span style='color:red'>The Hold-Off entered must be in digits</span>"
                            }
                        }
                    }
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 61,667Questions: 1Answers: 10,096 Site admin

    Yes, as I noted above, this is not something that Editor currently handles well I'm afraid as it would require multiple fields to be inline editable at the same time. For cases when one field can effect the validity of another you'd need to use bubble editing (bubble()) which does support multiple fields at a time.

    Allan

This discussion has been closed.