preSubmit with inline - determine the field just edited

preSubmit with inline - determine the field just edited

CT General AssemblyCT General Assembly Posts: 14Questions: 2Answers: 1

I have inline editing with option "all". I want to determine if the user is on a particular field and if they are trying to leave the field, ensure the field is not blank. If it is blank, keep them there. Two problems, in the preSubmit, I cannot determine which field they were on. Also, the preSubmit is firing when inline editing opens.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 46,189Questions: 1Answers: 6,410 Site admin
    Answer ✓

    You can use modifier() to find out what item was passed in to trigger the editing. With inline editing that is usually the cell node. The other option is the displayed() option which will just return a single field if you are inline editing.

    Also, the preSubmit is firing when inline editing opens.

    That's weird. It should only trigger when the form is submitted. Might it be getting submitted anywhere?

    Allan

  • CT General AssemblyCT General Assembly Posts: 14Questions: 2Answers: 1

    Allan,

    Once again, you are a genius!

    displayed() worked perfectly for determining which field is being edited. As for the preSubmit firing twice, I think it's because I'm using "all" instead of "allIfChanged". I tested and that is the case.I need to use "all", otherwise the submit never fires for a blank row and then I can't capture the fact that they left the description blank. We are using ajax instead of the other back-end options you offer so the validation has to be client-side.

    I think it will work though because now I'm able to validate for a blank description on my form.

    Cheryl

Sign In or Register to comment.