Tracker Capture - Input Fields Validation

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.

···

Regards,
Muhammad Tahir

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

Please have a look, and let us know if we can help with anything!

Markus

···

Regards,
Muhammad Tahir

Markus,

A series of valid expression examples would be very useful, including examples using multiple actions.

Can those expressions include lookup functions into other tables or stored views in the system?

Regards

Calle

···

On 25 April 2016 at 14:37, Markus Bekken markus.bekken@gmail.com wrote:

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

Please have a look, and let us know if we can help with anything!

Markus

  1. apr. 2016 kl. 07.30 skrev Muhammad Tahir mtagb09@gmail.com:

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.


Regards,
Muhammad Tahir


Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi Markus,

Your answer is very helpful, but unfortunately we are on version 2.23 and won’t be able to use this.

Is there any way around to achieve the same.

@Calle: Thank you highlighting the loop option, we are also looking for this to validate the values in DB.

···

On Mon, Apr 25, 2016 at 6:21 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Markus,

A series of valid expression examples would be very useful, including examples using multiple actions.

Can those expressions include lookup functions into other tables or stored views in the system?

Regards

Calle

On 25 April 2016 at 14:37, Markus Bekken markus.bekken@gmail.com wrote:

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

Please have a look, and let us know if we can help with anything!

Markus

  1. apr. 2016 kl. 07.30 skrev Muhammad Tahir mtagb09@gmail.com:

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.


Regards,
Muhammad Tahir


Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Regards,
Muhammad Tahir

Correction, we are on version 2.22

···

On Tue, Apr 26, 2016 at 9:56 AM, Muhammad Tahir mtagb09@gmail.com wrote:

Hi Markus,

Your answer is very helpful, but unfortunately we are on version 2.23 and won’t be able to use this.

Is there any way around to achieve the same.

@Calle: Thank you highlighting the loop option, we are also looking for this to validate the values in DB.

On Mon, Apr 25, 2016 at 6:21 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Markus,

A series of valid expression examples would be very useful, including examples using multiple actions.

Can those expressions include lookup functions into other tables or stored views in the system?

Regards

Calle

Regards,
Muhammad Tahir

On 25 April 2016 at 14:37, Markus Bekken markus.bekken@gmail.com wrote:

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

Please have a look, and let us know if we can help with anything!

Markus

  1. apr. 2016 kl. 07.30 skrev Muhammad Tahir mtagb09@gmail.com:

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.


Regards,
Muhammad Tahir


Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Regards,
Muhammad Tahir

Hi again Muhammad,

d2:validatePattern and d2:length could conveniently be backported - they are now supported in the latest 2.22 build.

Calle: Added a few examples to the user manual, which can be found here: http://dhis2.github.io/dhis2-docs/master/en/user/html/ch31s05.html

The program rules generally access data within one enrollment for tracker programs. Data values from data elements and tracked entity attributes, along with constants and a set of variables defined here: http://dhis2.github.io/dhis2-docs/master/en/user/html/ch30s03.html

For event capture, the program rules access data values from the current event, and events within the same program and organization unit.

Not to say we cant expand this in future releases, please comment and or create blueprints for what would be useful in your context.

Best regards,

Markus

···

On Tue, Apr 26, 2016 at 9:56 AM, Muhammad Tahir mtagb09@gmail.com wrote:

Hi Markus,

Your answer is very helpful, but unfortunately we are on version 2.23 and won’t be able to use this.

Is there any way around to achieve the same.

@Calle: Thank you highlighting the loop option, we are also looking for this to validate the values in DB.

On Mon, Apr 25, 2016 at 6:21 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Markus,

A series of valid expression examples would be very useful, including examples using multiple actions.

Can those expressions include lookup functions into other tables or stored views in the system?

Regards

Calle

Regards,
Muhammad Tahir

On 25 April 2016 at 14:37, Markus Bekken markus.bekken@gmail.com wrote:

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:<Skjermbilde 2016-04-25 kl. 13.58.01.png>

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

<Skjermbilde 2016-04-25 kl. 14.12.28.png>

Please have a look, and let us know if we can help with anything!

Markus

  1. apr. 2016 kl. 07.30 skrev Muhammad Tahir mtagb09@gmail.com:

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.


Regards,
Muhammad Tahir


Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Regards,
Muhammad Tahir

Thankyou Markus :slight_smile:

···

On Wed, Apr 27, 2016 at 2:02 PM, Markus Bekken markus.bekken@gmail.com wrote:

Hi again Muhammad,
d2:validatePattern and d2:length could conveniently be backported - they are now supported in the latest 2.22 build.

Calle: Added a few examples to the user manual, which can be found here: http://dhis2.github.io/dhis2-docs/master/en/user/html/ch31s05.html

The program rules generally access data within one enrollment for tracker programs. Data values from data elements and tracked entity attributes, along with constants and a set of variables defined here: http://dhis2.github.io/dhis2-docs/master/en/user/html/ch30s03.html

For event capture, the program rules access data values from the current event, and events within the same program and organization unit.

Not to say we cant expand this in future releases, please comment and or create blueprints for what would be useful in your context.

Best regards,

Markus

  1. apr. 2016 kl. 07.01 skrev Muhammad Tahir mtagb09@gmail.com:

Correction, we are on version 2.22

On Tue, Apr 26, 2016 at 9:56 AM, Muhammad Tahir mtagb09@gmail.com wrote:

Hi Markus,

Your answer is very helpful, but unfortunately we are on version 2.23 and won’t be able to use this.

Is there any way around to achieve the same.

@Calle: Thank you highlighting the loop option, we are also looking for this to validate the values in DB.

Regards,
Muhammad Tahir

On Mon, Apr 25, 2016 at 6:21 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Markus,

A series of valid expression examples would be very useful, including examples using multiple actions.

Can those expressions include lookup functions into other tables or stored views in the system?

Regards

Calle

Regards,
Muhammad Tahir

On 25 April 2016 at 14:37, Markus Bekken markus.bekken@gmail.com wrote:

Hi Muhammad,

There is support for this in the 2.23 release(just out), via the program rules.

Right clicking on your program in the programs app, select program rules - and you can create a rule like this:<Skjermbilde 2016-04-25 kl. 13.58.01.png>

If you also want to validate that the field has a certain pattern, you could expand the rule with a regular expression matching check. The below example checks wether the address field is containing letters and spaces, followed by a space and then a number. The regex is [\w ]+ \d+ - notice that the backslashes needs to be escaped:

<Skjermbilde 2016-04-25 kl. 14.12.28.png>

Please have a look, and let us know if we can help with anything!

Markus

  1. apr. 2016 kl. 07.30 skrev Muhammad Tahir mtagb09@gmail.com:

Hi,

While working with Tracker Capture, is there any possibility to add validation (Js/jquery validation or any other) via front-end or we have to make changes at code level to achieve this?

We have created some fields as TEXT, but want to restrict the length and pattern to restrict users to enter correct data.


Regards,
Muhammad Tahir


Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Regards,
Muhammad Tahir