plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

Troubleshooting a Dynamic Hide-When Issue #683

Open glimmung opened 9 years ago

glimmung commented 9 years ago

Hi,

I have a sequence of forms in site which make use of the Dynamic Hide-When, and now and again the feature stops working in /EditDocument but continues to work in /view (IOW, fails when editing an existing doc, but works prior to saving). When I look at the JSON response, it contains the expected true/false values when it works, but is empty when it does not work.

This is a bit low-level for me - I'm not sure how to approach troubleshooting it - can anyone provide any hints? The point that I'm stuck on is it working on an unsaved doc but not a saved doc - I don' see how that affects the mechanism.

After stepping through the series of forms, the hide-when's on all forms have all started to work at once, just as they all failed at once - I just don't see a pattern...

TIA


Cheers,

PhilK

glimmung commented 9 years ago

I think this is to do with the sequnce of forms all acting on the same document - they are all calling the same URL. e.g. /plomino_documents/42807a42506e40529d1a26e4e990e282/computehidewhens , but against different forms. If I go forward a form, I see the "hide when" name for the /previous/ form, but if i then go back it all seems to burst into life. I think that the reason the problem does not occur in /view is that of course that is not part of such a sequence.

ebrehault commented 9 years ago

Which version of Plomino do you use?

glimmung commented 9 years ago

Hi Eric,

We're on CMFPlomino 1.19.4.

My current hypothesis is that the issue is related to: -

glimmung commented 9 years ago

I've tried syncing the hide-when's, testing as I've gone, and it definitely seems to be one step out of sequence. As I write, I have reached the 4th form (of six, and while 1-4 have the first 2 x hide-when's, only the 4th form has the 3rd instance), and I get computedhidewhens={"NotStudentApplication": true, "NotPreviousMember": true}. On the 5th form, I get computedhidewhens={"NotStudentApplication": true, "NotPreviousMember": true, "CurrentRoleNotOther": true}, which is what I expected on the 4th, so it seems to be "asking" on the basis of the form the document is saved with, rather than the form it is opened with.

glimmung commented 9 years ago

Looks like it was my use of 'openwithform' - at each stage the form set in the doc was one step behind the form opened with, and it seems the 'hidewhen' behaviour is driven by the form saved in the record, not the form by which it is opened. I don't know quite why it worked for periods, and then not - but having set the form name on open now, the behaviour is as expected, and is consistent in my testing so far.

Hope this helps anyone else who creates this sort of 'hall of mirrors'! :-)