Assign field value with javascript function
Last Post 04-08-2014 02:38 PM by Mark Buelsing. 0 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages Not Resolved
Mark BuelsingUser is Offline
river guide
river guide
Posts:241
Avatar

--
04-08-2014 02:38 PM
    Why can I not assign a value to a textbox in a Javascript function using the same script that works outside the function?

    I have a line of javascript  that puts '5' into a textbox whose short name is MyCost. Here it is:
    $(MyCost)=5;

    It works fine in a client side event. It puts a 5 in the textbox.
    It works fine in the initial javascript of a Dynamic Form

    If I put it in a javascript function and call the function from a client side event. It does not work. The 5 never arrives when triggered.

    If I remove the line in question from the function and instead use this different method to put a 5 in the box, it works.

    document.getElementById('dnn_ctr1741_DynamicForms_TBR_GUID2c12b8ab-569e-4b16-8898-8cbbe554a8bbAA02Cost').value= '5';

    Which means that the function is not otherwise broken. It appears that just this line of code just does not work in a function. $(MyCost)=5;

    Why does this line work when called other ways, but not when used in a javascript function? Is this a syntax issue?

    I know you will want to examine the function itself so I have pasted it below.

    But really, what I am really wanting to know is what is the shortest and easiest way to put a value into a textbox from a function? I am looking for an alternative to the "document.getElementById() method because it is long to type and I have to go to extra effort to discover and copy and paste the very long control ID into the function.

    So the most valuable answer to me is, what is the cleanest, easiest way to assign a value into a Dynamic Forms textbox from inside a javascript function?

    Thanks for your help

    Mark


    function NewCalcInBox() {

    $(MyCost)=5;
        document.getElementById('dnn_ctr2208_DynamicForms_TBR_GUIDee5ced08-89fc-4e28-ac00-70a8c482ff98AMyCost').value = '5';
    };



    ---
  • 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