Javascript
Last Post 02-08-2010 10:20 AM by David To. 7 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Beth LancasterUser is Offline
skipping stones
skipping stones
Posts:8
Avatar

--
02-03-2010 08:07 PM

    Is it possible to use javascript to evaluate the value in the token and hide or show info based on that value.  For instance, if the field is "Smoking" and I want to show an icon representing that, can I put in javascript to do that?  Can I tell if a token is null or empty?

    Also, if not in javascript, do you have any other ways to do that?

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    02-04-2010 10:35 AM
    HI, yes you should be able to embed javascript within the DUD template although I've never tried it before. Since the Rich Text Editor supports HTML, you simply click on the "Source" and then add your javascript logic there. I hope this answers your question although I've never tried this before. Tell me how it goes. -- David
    Beth LancasterUser is Offline
    skipping stones
    skipping stones
    Posts:8
    Avatar

    --
    02-04-2010 10:56 AM
    I had tried it before and it didn't seem to work, but now it is working well. Thanks.
    David To HostUser is Offline
    going with the flow
    going with the flow
    Posts:54
    Avatar

    --
    02-04-2010 11:09 AM
    HI, can you post an example for all to see and use? Perhaps copy the "Source" of your template and paste it here. Thanks. -- David
    Beth LancasterUser is Offline
    skipping stones
    skipping stones
    Posts:8
    Avatar

    --
    02-04-2010 07:19 PM

    I got javascript working in the code, but still can't seem to reference the tokens to pull back the value.  Any suggestions?  These are tokens from the User Directory module including some custom ones.

    Beth LancasterUser is Offline
    skipping stones
    skipping stones
    Posts:8
    Avatar

    --
    02-04-2010 08:42 PM

    Here is what I did to display text or an image based on the value of a field in the DUD.  The quotes around the script aren't needed but I couldn't display here without them.  The most important thing was the single quotes around the token name.

    Use less than symbol here and then

    script type="text/javascript"

    var sex = '[Sex1]';

    if (sex == 'F')
      {
      document.write("image reference here ");
      }
    else
    {
    document.write("MALE");

    }

    Beth LancasterUser is Offline
    skipping stones
    skipping stones
    Posts:8
    Avatar

    --
    02-06-2010 04:41 PM
    This only works in the details part of the template. For some reason, the Item / List Template won't allow the same functions to work. Is there a reason that this area is locked down?
    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    02-08-2010 10:20 AM
    I don't know if it will work in the listing since that's done from an SQL query and may not filter based on javascript. -- David


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi