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.
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!
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!
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.
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!
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.
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!
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.
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.
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!
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.
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.
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!
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.