Closed Jegelewicz closed 2 years ago
getCTdoc(table,value)
, value is optional - function updated
Trying to make this work here
but it doesn't DO anything. What am I doing wrong?
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source');">Define</span>
Woops - reload.
Noice. I am going to run the options for "defining" this stuff by the taxonomy committee tomorrow. I like this one the best because it is responsive and if we really start using it everywhere people might get to know it better.
OK - but I need to add a value if I want this be responsive? Tried this, but it doesn't work.
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source',SpecData.souce.value);">Define</span>
add a value
Yea it's worth doing - doesn't matter if there are ~a dozen to sort through, this could realistically grow to where the anchor is necessary.
document.getElementById("fld_id").value
or if you like jquery
$("#fld_id").val()
I've probably got antique form.field.... references hanging around, if possible everything should get modernized to have and use IDs.
OK - me being dense, but I tried
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById("fld_id").value)";>Define</span>
and
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById("source").value)";>Define</span>
but that doesn't work.
what form are you on?
first example you need actual ID
second youre mixing ' and "
mixing ' and "
hope that's it! fixed to using '
what form are you on?
clone classification into a new name
OK, finally got this to work, but it only works sporadically. Once you use the "Define" with any given term, the next time you use it (without exiting the form) you just get the code table, not the specific term you are looking at.
Devtools shows a mangled compile, which is about always invalid syntax.
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById('taxonomy_source').value)";>Define</span>
the semicolon is lost
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById('taxonomy_source').value);">Define</span>
Thank you! I have learned a ton the last two days!!!
Should I make it my mission to get all of these working consistently? And perhaps adding them where they are missing?
Here's a lesson: sometimes I'm full of crap....
getElementById is wonky with selects, I changed it to jquery which is what I usually use - it abstracts the details. Now my replace is being weird with multiple not-alphanumeric, but I think the html parts are happy.
Coolio - so now this is the path?
<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', $('##source').val());">Define</span>
path
Err - until its not.....
I threw together a new function that should be a little less convoluted to use, and will be easier to update when it turns out we needed to sanitize or something.
<span class="infoLink" onclick="getCtDocVal('cttaxonomy_source','source');">Define</span>
cttaxonomy_source is the code table, same as the old
source is the ID of the element
should work the same as the old, just avoids the need to pass values around. It does rely on ID, so don't use it in any antique forms that don't have that.
As far as sprinkling this around, I want to emphatically say "yes" BUT I don't know if anyone uses them. (I suppose we should have a creepy click-tracker, but we don't.) We've spent a ridiculous amount of effort getting good documentation and making it easy to access, and I really have no idea if any of that's been effective or not. So still yes, unless you have a better idea for making the documentation hard to avoid, I suppose.
don't use it in any antique forms that don't have that.
How can I identify forms that don't?
As far as sprinkling this around, I want to emphatically say "yes" BUT I don't know if anyone uses them.
I'm going to discuss this with taxonomy committee tomorrow and if I can fit it in I'll try to get code table committee to look too. If people think this is a nice thing, then a newsletter article and the occasional Tweet about it might get it used more often. I think it is really great to have that code table pop up, but I may be one of the few who ever looks at the code tables....
BTW - this isn't working in either of these places:
<span class="infoLink" onclick="getCtDocVal('cttaxon_name_type', 'taxon_name_type');">Define</span>
<span class="infoLink" onclick="getCtDocVal('cttaxon_relation', 'TAXON_RELATIONSHIP');">Define</span>
Possibly because I don't know the correct thing to use in "value". Also, does capitalization matter? Previously some things were caps and some not, but either they were working or nobody noticed they weren't.
@dustymc how does the getCTdoc thingee work? Right now links to terms when using the "define" function don't take you to the term in question because the url generated includes an "=" instead of a "#". Also, I'd like to use this in some other places, but am not 100% sure how to make it work. (Specifically right now for taxonomy source and taxonomy terms).