Loading...
 
Features / Usability

Features / Usability


JQ issue

posts: 41 US

I don't want to flood the forums with this topic, but it remains a pressing issue for me.

I am using:

  • Pretty Tracker (NewtrackerItem page, tracker page creator, and pretty template)


I am trying to use JQ on the template page to manipulate some DIVs
Example:


NOTES:



All I want to do it when #f_14 has a null value, hide the "NOTES" DIV. Simple right?

Currently I am able to hide the DIV, but even when there is data in the field, it remains hidden.
Here is my actual code:

Copy to clipboard
{DIV(id="status")}Status Update: {BOX(class="MAIN_BOXES" id="status_box")}{$f_62} {BOX} {DIV}


and here is my JQ:

{JQ()}
if (!$("#ins_14").val()) {
$("#release").hide();
}
{JQ}

#release is the id of the DIV
I am assuming that the problem is reaching the data from the tracker to the template.

posts: 1563 Germany

Hi Avo,

there is no element with an Id #release, but only #status and #status_box.

for posting into the forum you should use the CODE plugin to show the wiki plugin code (I fixed for you) and you should consider to use the tag, when the CODE plugin does not work with JavaScript code (I fixed that for you aswell). DId you check this page: [https://doc.tiki.org/Pretty Tracker#Dynamic_Pretty_Trackers|Dynamic_Pretty_Trackers] ~np~
Copy to clipboard
{DIV(type="div",bg="green",align="left",float="none",clear="none")} {TRACKER(trackerId="9" wiki="Dynamic tracker example template")}Good Job.{TRACKER} {DIV}


Template (on wiki page):

Dynamic tracker example template

Copy to clipboard
Content type: {$f_121} {DIV(type="div",id="fileprompt")} File: {$f_122} {DIV} {DIV(type="div",id="urlprompt")} url: {$f_123} {DIV} Did you ensure this does not breach policy? {$f_124} {JQ()} $("#fileprompt").hide(); $("#urlprompt").hide(); $("input[name='ins_121']").change(function(){ if ($(this).filter(":checked").val() === 'File') { $("#urlprompt").hide(); $("#fileprompt").fadeIn(); } else { $("#fileprompt").hide(); $("#urlprompt").fadeIn(); } }); $("select[name='ins_124']").change(function(){ if ($(this).find("option:checked").attr("value") === 'No') { alert("Then go do your homework."); } }); /* $(".input_submit_container").parent().submit(function(){ if ($("input:radio[name='ins_121']:checked").val() === 'File') { if ($("[name='ins_122']").val() === '') { alert("File is required."); return false; } } else { if ($("[name='ins_123']").val() === '') { alert("URL is required."); return false; } } });*/ {JQ}

 


posts: 41 US

Hi Torsten,

Thank you for the quick response and forum etiquette tips. Lets see if I can do it right.

So after reviewing the example you sent me I have revised my div/JQ to the following:

Copy to clipboard
{DIV(type="div",id="release")} !!!Release Notes {BOX( class="MAIN_BOXES")}{$f_14}{BOX}{DIV}

 

JQ

Copy to clipboard
$("input[name='ins_14']").change(function(){ if ($(this).val() === '') { $("#release").hide(); } });

 

So it seems like I am still having an issue with my implementation. Any other ideas??


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting