Select to view content in your preferred language

All repeats not being checked for required fields when coming back from Draft

351
5
11-09-2023 08:15 AM
DougBrowning
MVP Esteemed Contributor

I thought this had been posted before but I can't find it.  We have had issues with calculations when coming back from draft but now it's also required.

We can recreate this at will.

Users leaves a required field blank in the last repeat, save as draft, open from drafts and form will show the first repeat, if they submit right away without navigating the repeats, it will never recheck the required fields in any of the repeats.  This leaves us with null repeat records.

The form should recheck all repeats for required fields on a submit and that would solve it I think.  Not sure why it is not.

Is this on the list to be fixed yet?  @JamesTedrick 

thanks  

0 Kudos
5 Replies
abureaux
MVP Regular Contributor

This seems to be an issue with repeats in general. They act like Schrodinger's Repeat in that their state is essentially unknown until observed. I am thinking that this was done to conserve CPU/power, but I also desperately need a way "observe" a repeat to have it recalculate calculates and check required fields. JS would work, but I don't know how that would look, or if it's even possible.

MobiusSnake
MVP

I might be wrong about this, but I think I ran into something like this some time back and got around it by using the count() function.

IIRC, count() won't include missing values, so if you compare the results of count() from one question to another you know will be there (say, a hidden question with a default value and a null data type), if there's a count mismatch then you know a value a missing.

I'm reaching some time back in my memory so I might be misremembering though, apologies if so.

0 Kudos
DougBrowning
MVP Esteemed Contributor

You mean a if(null,1,0) type thing?  Maybe if that is outside the repeat it would fire but maybe not.  Known issues with calcs not firing when coming back from repeats also.  Issue I see is you would have to have one of these for every single required fields.

I get its the way repeats work.  They all have the same field names and just the data page is swapped out underneath.  So it is says is Field1 good?  Yep.  But it needs to check repeat1\Field1, repeat2\Field1, etc.

0 Kudos
MobiusSnake
MVP

I've attached an XLSX with what I mean.  I just gave it a quick test and it stopped me from submitting (although maybe I didn't repro what you described accurately)

0 Kudos
DougBrowning
MVP Esteemed Contributor

I get what you are saying now.  Basically a count() does not count a blank so you can check a calc field in my repeat (we bring down a key from the parent so we had that already) against the blank field like this  if(count(${RecKey}) = count(${SpeciesList}), "No Nulls", "Has Nulls")

Still testing as at times it was not catching that constraint on a draft also.

thanks a lot

0 Kudos