Displaying a warning when a field is changed in a form

Hopefully a quick question.

Background - When a person’s name is changed in the CRM, we plan on pushing that change out to other council systems. However, at present, the name changing policy isn’t consistent throughout the council (some require proof of marriage etc).

As a first step to working through this, we want to display a message when a CRM user attempts to change a person’s name in the CRM. Ideally, it’ll work similar to when you try to add a duplicate entry into a field that’s been marked unique (as in, the message appears when you tab out of the field).

My initial thought was to just add to the form 2 instances of the name field (one editable and 1 hidden), and a heading element for the warning. Then use the dependencies to control when the warning is displayed, by comparing the two fields. Unfortunately, I have to supply a pre-defined string to the dependency (I can’t compare the two fields to see if it’s changed), so I don’t think this approach will work.

Is there a way of doing this I’m not seeing.

Thanks in advance

Stephen

My initial thoughts are a fragment validator to compare the fields and show a message.

However I’m interested in this scenario generally, as we too have many conversations about whether its right to propagate changes like this to the resident’s other cases (current and past). At the moment we give the CSA the choice to just update CHCentral, or propagate to the other cases - which is fine because the resident is on the phone and they can ask them.

In the future, I would like to look at making this a bit more self-service. I.e, when we get contrasting data about a user, send them an email linking to an “update my details” form, and then ask them if they would like to update any other records we hold. I hope this could grow into a tell-us-once feature where we can email the sys admins of other systems to update too - but it seems a bit of a minefield to unpick and design the best way to do things.

just looking around for an example of where we are using a validator to compare a value on screen with a value in the object, and this might be similar to what you need:

var value = fragment_presenter.get_value() ||'';
var collection_id = fragment_presenter.get_context_record_id();
var collectionrecord = mats.record(collection_id);
var obj_id = collectionrecord.get_object_id();

return (fragment_presenter.get_displayable_value()<=collectionrecord.get(mats.ref('field_choc_number_of_bin_in_subscription'))) ? true:'You can not request more bins than you have in your subscription.';

This however would stop you submitting a form, I wonder if a fragment callback might be better as it could warn you, but not prevent submission of the form. The code will be very similar.

Many thanks. I’ve re-worked your code example and got it working as required.

1 Like