Validation of Form Fields during Entry

I would like to be able to validate form fields as the user enters the data in the fields with HTML form entry module.

The current javascript hooks that I see are beforeSubmit and beforeValidation.

1 Like

Hi @ssmusoke,

Have a look at https://wiki.openmrs.org/display/docs/HTML+Form+Entry+JavaScript+Reference

Specifically check out… getField(idAndProperty)

You can use this to trigger some JavaScript code when a field changes (or is initially entered).

@arbaughj my question is how do I trigger the validation on change. Is there a standard hook or do I have to add an onchange trigger for each field

I don’t think we have an HFE-specific hook for a change on any field.

You should be able to use a standard jQuery hook. (You might need to put a div with an id inside the htmlform since I don’t know if you can put an id on the html form.)

-Darius (by phone)

1 Like