Search
 

Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Dynamic Javascript Function to run onload of page
Last Post 06-24-2009 06:19 AM by David To. 6 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Craig LambieUser is Offline
river guide
river guide
Posts:87
Avatar

--
06-23-2009 01:38 AM

    Hi

    I would like a dynamic JS function to run, based on the content of a Dynamic Field, it shows a Div in a HTML field, and hides the others.

    At the moment they are all staying hidden until I click on the field that changes them.

    I would like the JS to run, based on the fields value at load of page.  How to tell JS which field it is dynamically?

    Thanks

    C

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

    --
    06-23-2009 07:33 AM
    Hi Craig, try going to JS function under Module Configuration / Javascript / Custom Javascript File and place it in the Initial Javascript. That way, the JS function will run on page load. See if this works for you. -- David
    Craig LambieUser is Offline
    river guide
    river guide
    Posts:87
    Avatar

    --
    06-23-2009 07:48 AM

    Hi David,

    The issue is the dynamic field ID.

    If I put

    function test($(ShortFieldName_FieldID) {

    }

    will that work?? I don't think so.

    I need to dynamically tell it the field ID, or hard code it in??

    C

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

    --
    06-23-2009 08:55 AM
    HI Craig, check out some of the functions under Custom Javascript file. If you place your functions there, you should be able to use a variable name. Then you call the function passing the $(ShortFieldName_FieldID) token value in the initial page load. -- David
    Craig LambieUser is Offline
    river guide
    river guide
    Posts:87
    Avatar

    --
    06-23-2009 03:45 PM
    Ok, so as suspected, the funtion doesn't appear to work.
    ShortFieldName = AccountType
    Mind, the JS is not erroring, so I would suspect it is using the standard $function which is document.getElementById(
    ??? How do I tell the function to run, and tell it the ASPX ClientID of AccountType?
    ------------------js extract-------------

    //onload function to run
    shHTML($(AccountType_FieldID));

    function shHTML(varAcTypeID) {


    var vC1 = $('Consumer1');
    var vC2 = $('Consumer2');
    var vB1 = $('Biz1');
    var vB2 = $('Biz2');
    var vB3 = $('Biz3');
    var AcType = $(varAcTypeID);
    var vP = $('Promo');


    showhtml(vP.id);

    //Handle Changed Account Type
    switch (AcType.options[AcType.selectedIndex].value) {
    case 'Consumer - Free':
    showhtml(vC1.id);
    hidehtml(vC2.id); hidehtml(vB1.id); hidehtml(vB2.id); hidehtml(vB3.id);
    break;
    case 'Consumer - Full Registered':
    showhtml(vC2.id);
    hidehtml(vC1.id); hidehtml(vB1.id); hidehtml(vB2.id); hidehtml(vB3.id);
    break;
    case 'Business - Standard':
    showhtml(vB1.id);
    hidehtml(vC2.id); hidehtml(vC1.id); hidehtml(vB2.id); hidehtml(vB3.id);
    break;
    case 'Business - Gold':
    showhtml(vB2.id);
    hidehtml(vC2.id); hidehtml(vB1.id); hidehtml(vC1.id); hidehtml(vB3.id);
    break;
    case 'Business - Platinium':
    showhtml(vB3.id);
    hidehtml(vC2.id); hidehtml(vB1.id); hidehtml(vB2.id); hidehtml(vC1.id);
    break;
    default:
    break;
    } //end Switch

    } //end ShowHideHTML
    Craig LambieUser is Offline
    river guide
    river guide
    Posts:87
    Avatar

    --
    06-23-2009 04:10 PM
    just had a thought, that maybe you meant I could create another field, with a client event, onload, but this is not on of the available keywords for the events.
    David ToUser is Offline
    river guide
    river guide
    Posts:2736
    Avatar

    --
    06-24-2009 06:19 AM
    Hi Craig, at page load, what is the actual field value of AccountType? Is there a default value? Also, if you use Firefox, can you download and install Firebug to trace through the javascript code and see what value it is actually seeing, if any? -- David
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way

     

     

       
    Subscribe Me
     
    Copyright 2005 - 2011 by Data Springs, Inc.