← Back to team overview

dhis2-devs team mailing list archive

Re: custom HTML attributes missing when you open a custom form using the 'Event Capture' app

 

Hi Jose,

Great that you made the test. But, as I mentioned, my fix was to trunk -
revision 15844. Can you try on trunk? or you want it in 2.15?

Thank you,
Abyot.


On Sat, Jul 5, 2014 at 6:00 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
wrote:

>
> Hi Abyot,
>
> Many thanks for your help and I'm sorry for my late response...
>
> I am testing with the revision 15183 (build date 2014-07-05), but still I
> am getting similar results. So if we define an input tag as:
>
> <input custype="test" id="tRL93Q4GS9M-Gp5Dc40z9Yg-val" maxlength="10"
> name="entryfield" onchange="test()" size="10" title="[ Gp5Dc40z9Yg - TZ RH
> CC - Age - number ]" type="text" value="[TZ RH CC - Age]" />
>
> where 'custype' is a custom attribute, 'onchange' is an event to be
> captured by test() function, and 'size' and 'maxlength' are html
> attributes. However in the HTML output we are missing all of them:
>
> <input type="number" name="Gp5Dc40z9Yg"
> ng-model="currentEvent.Gp5Dc40z9Yg"
> ng-required="programStageDataElements.Gp5Dc40z9Yg.compulsory"
> class="ng-pristine ng-valid-number ng-invalid ng-invalid-required"
> required="required">
>
> I don´t know much about AnjularJS, so maybe I am missing something.
>
> Thanks
> Jose
>
>
> On Wed, Jun 25, 2014 at 1:11 PM, Abyot Gizaw <abyota@xxxxxxxxx> wrote:
>
>> Hi Jose,
>>
>> We just made a fix, to trunk, that keeps html attributes intact. Your
>> custom form should now work. Is it possible for you to test?
>>
>> Thank you,
>> Abyot.
>>
>>
>> On Mon, Jun 16, 2014 at 2:43 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>> wrote:
>>
>>>
>>> (Sorry I forgot the subject in my last email)
>>>
>>> Dear dev community,
>>>
>>> PSI usually develops custom forms (both on the aggregated and tracker
>>> side) with script code in order to implement extra functionality ot get the
>>> control of some input html fields. For example we can introduce extra
>>> attributes or events in the HTML tags as follows (where 'custype' attribute
>>> and the 'onchange' event have been introduced using the html code editor)
>>>
>>> <input custype="age" id="fWJzMgoTWeU-VAGbWSzFIFg-val" name="entryfield"
>>> onchange="test()" title="[ VAGbWSzFIFg - TZ CC - Age - posInt ]" value="[TZ
>>> CC - Age]" />
>>>
>>>  Now in Data Entry, If we open the form using the  "old" 'Single Event
>>> Without Registration Managment' (under 'Individual Records'), we can see
>>> the code above re-written as:
>>>
>>> <input custype="age" id="fWJzMgoTWeU-VAGbWSzFIFg-val" name="entryfield"
>>> onchange="test()" title="[ VAGbWSzFIFg - TZ CC - Age - posInt ]" value=""
>>> tabindex="1" data="{compulsory:false, deName:'TZ CC - Age',
>>> deType:'posInt'}" options="false" maxlength="255" onkeypress="return
>>> keyPress(event, this)" class="inputText">   where all HTML attributes are
>>> there.
>>>
>>> However if we use the new 'Event Capture' app, we get the following code:
>>>
>>> <input type="number" name="VAGbWSzFIFg"
>>> ng-model="currentEvent.VAGbWSzFIFg"
>>> ng-required="programStageDataElements.VAGbWSzFIFg.compulsory"
>>> class="ng-valid-number ng-valid ng-valid-required ng-dirty">
>>>
>>> where all attributes and events are missing.
>>>
>>> Usually we get the control of HTML input fields using jQuery as follows:
>>> $("input[custype='age']"), so now using the Event Capture app we are not
>>> allowed to do that. Of course, we can use instead
>>> $("input[name='VAGbWSzFIFg']"), but this is more like a temporal solution
>>> (as it is not very readable and we cannot get the control of several DEs
>>> with the same attribute values).
>>>
>>> Any ideas/solutions?
>>>
>>> Thanks
>>> Jose
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>

References