1

Topic: Boolean as parent for attribute

Hi guys,

I wonder if it's possible to specify a boolean as a parent or prerequest to edit it's children. Actually, the same as how to edit the sensitivity now. Hit the boolean and you can edit the blur thing.... but then for attributes. Hit the boolean to yes and then you can edit for example a picking list or whatever... It's just that people do not start to edit it when not necessary. :)

Dieter

2

Re: Boolean as parent for attribute

Hi Dieter
There is nothing built in, but it sounds like the sort of thing a little jQuery JavaScript on the page could do very easily. You can add your own scripts to the page- see http://indicia-docs.readthedocs.org/en/ … lity.html.
Best wishes
John

John van Breda
Biodiverse IT

3

Re: Boolean as parent for attribute

Sorry, I don't have developing knowledge. Else I would not ask all of this I guess. :rolleyes:
I can try but first I will need an example.

4

Re: Boolean as parent for attribute

Hi Dieter,

Do you have access to any funding for development work? Who are you working with?

While we are very happy to make Indicia freely available for reuse, especially where it enhances our scientific objectives, virtually all of the development work has been paid for by one organisation or another.

I am employed by the Natural Environment Research Council and we contract John to do most of the development work we require.

Jim Bacon.

5

Re: Boolean as parent for attribute

Hi, sorry for my very slow response. I will try to learn a bit the java code and do it myself. If I'm not able to do it, I can inform about the funding if it is opportune.

Dieter

6

Re: Boolean as parent for attribute

That sounds like a good idea. Remember, Google is your friend.
I found http://stackoverflow.com/questions/2330 … le-disable for example.

Jim Bacon.

7

Re: Boolean as parent for attribute

Okay, I finally took some time to test this. I managed to make a random html file with jquery script that had this function. So far so good, this worked pretty easy. But still no idea how to do it in indicia.

As far as I could interpret the example on stackoverflow it should become something like this?

---See txt file for the code....-----

But no clue how to make this work in Indica

The first

Post's attachments

Code.txt 550 b, 5 downloads since 2015-06-13 

You don't have the permssions to download the attachments of this post.

8

Re: Boolean as parent for attribute

Well done.

To make it work with Indicia you have to save your javascript in to a file with the correct name in the correct directory.
See http://indicia-docs.readthedocs.org/en/ … ality.html

Once you have done that you can use the developer tools of your browser to check that your JavaScript file is loaded.

As soon as you can see your file is loaded then it will be a simple matter to debug your script. It looks like you have already identified the id attributes of the html inputs you want to select with jQuery.

Good luck.
Jim Bacon.

9

Re: Boolean as parent for attribute

I will try it. But not sure if he will recognize it since in het html code you have to specify classes belonging to the id. Let's see if it works like I made it. But I noticed with a : in occattr:5, it will not work. Don't know if it will work then since in Indicia you use these...

10 (edited by Jim Bacon 16-06-2015 10:13:37)

Re: Boolean as parent for attribute

Hi Dieter,

To select an item with id="occAttr:5" in jQuery use $("#occAttr\\:5")
See https://learn.jquery.com/using-jquery-c … -notation/

To add a class to a control on an Indicia recording form you edit the Form Structure in the User Interface section and add lines something like

[species]
@occAttr:6|occAttrClasses=["class1", "class2"] 

if the attribute is in a grid or

[species attributes]
@occAttr:6|class="class1 class2" 

if the attributes are all added together or

[occAttr:6]
@class="class1 class2" 

if the attribute is individually positioned.

If you are only controlling two inputs it might be easier to select them individually by id with two lines of JavaScript rather than going to the trouble of adding a class in order to use one line of JavaScript.

Jim Bacon.

11

Re: Boolean as parent for attribute

Thanks Jim,

This info is really welcome! :D

12

Re: Boolean as parent for attribute

Hooray! Works! :cool: