← Back to team overview

dhis2-devs team mailing list archive

Re: [Dhis2-users] Tracker Capture - Input Fields Validation

 

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

> 26. apr. 2016 kl. 07.01 skrev Muhammad Tahir <mtagb09@xxxxxxxxx>:
> 
> Correction, we are on version 2.22
> 
> On Tue, Apr 26, 2016 at 9:56 AM, Muhammad Tahir <mtagb09@xxxxxxxxx <mailto:mtagb09@xxxxxxxxx>> 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@xxxxxxxxx <mailto:calle.hedberg@xxxxxxxxx>> 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@xxxxxxxxx <mailto:markus.bekken@xxxxxxxxx>> 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
> 
>> 25. apr. 2016 kl. 07.30 skrev Muhammad Tahir <mtagb09@xxxxxxxxx <mailto:mtagb09@xxxxxxxxx>>:
>> 
>> 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 <https://launchpad.net/~dhis2-users>
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx <mailto:dhis2-users@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~dhis2-users <https://launchpad.net/~dhis2-users>
>> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs>
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx <mailto:dhis2-devs@xxxxxxxxxxxxxxxxxxx>
> Unsubscribe : https://launchpad.net/~dhis2-devs <https://launchpad.net/~dhis2-devs>
> More help   : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
> 
> 
> 
> 
> -- 
> ******************************************* <>
> Calle Hedberg
> 
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
> 
> Tel/fax (home): +27-21-685-6472 <tel:%2B27-21-685-6472>
> Cell: +27-82-853-5352 <tel:%2B27-82-853-5352>
> Iridium SatPhone: +8816-315-19119 <tel:%2B8816-315-19119>
> Email: calle.hedberg@xxxxxxxxx <mailto:calle.hedberg@xxxxxxxxx>
> Skype: calle_hedberg
> 
> *******************************************
> 
> 
> 
> 
> 
> -- 
> Regards,
> Muhammad Tahir
> 
> 
> 
> -- 
> Regards,
> Muhammad Tahir


Follow ups

References