← Back to team overview

dhis2-devs team mailing list archive

Fwd: bug fix of data entry with optionsets

 

---------- Forwarded message ----------
From: Murod Latifov <mlatifov@xxxxxxxxx>
Date: Mon, Jul 18, 2016 at 8:18 PM
Subject: Re: [Dhis2-devs] bug fix of data entry with optionsets
To: Knut Staring <knutst@xxxxxxxxx>


forgot to mention, this is in form.js of data entry module, the following
is the method

dhis2.de.setOptionNameInField = function( fieldId, value )
{
  var id = value.id;

  if(value.id.split("-").length == 3)
  {
    id = id.substr(12);
  }

var optionSetUid = dhis2.de.optionSets[id].uid;

DAO.store.get( 'optionSets', optionSetUid ).done( function( obj ) {
if ( obj && obj.optionSet && obj.optionSet.options ) {
$.each( obj.optionSet.options, function( inx, option ) {
if ( option && option.code == value.val ) {
          option.id = option.code;
          option.text = option.name;
         // $( fieldId ).select2("val", option.text );
          $( fieldId ).val( option.id ).change();
return false;
}
} );
}
} );
};

On Mon, Jul 18, 2016 at 7:53 PM, Knut Staring <knutst@xxxxxxxxx> wrote:

> Thanks Murod!
>
> I agree very much, this bug is super irritating - right now, it is
> impossible to see whether a value has been entered, and if so which one it
> was. I would classify this as quite critical, as it strikes at the basic
> data entry functionality.
>
> Knut
>
> On Mon, Jul 18, 2016 at 2:25 PM, Murod Latifov <mlatifov@xxxxxxxxx> wrote:
>
>> Hi,
>>
>> When opening data entry form with data form does not show already
>> selected value. To make form populate selected data the folling change
>> sgould be made
>>
>> remove :
>>
>> $( fieldId ).select2("val", option.text );
>>
>> add this instead:
>>
>>          $( fieldId ).val( option.id ).change();
>>
>> If someone with commit right could change the code would be great.
>>
>> best regards,
>> murod
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> Norway: +4791880522
> Skype: knutstar
> http://dhis2.org
>

References