Loading...
 
Features / Usability

Features / Usability


JQ issue

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:

{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.

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~
{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

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}

 


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:

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

 

JQ

$("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

No records to display

Why Register?

Register at tiki.org and you'll be able to use the account at any *.tiki.org site, thanks to the InterTiki feature. A valid email address is required to receive site notifications and occasional newsletters. You can opt out of these items at any time.