Client event using inner HTML
Last Post 07-11-2011 09:05 AM by David Amm. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages Resolved
David AmmUser is Offline
river guide
river guide
Posts:156
Avatar

--
06-30-2011 04:27 AM

    I have 2 fields: Q1 (a radio button) and Q2 (HTML). I want to display the result from Q1 in Q2. My code is as follows...

    document.getElementById('Q2').innerHTML = funcRadioCalc($(Q1_FieldID))

    When I select an option in Q1 the rusult does not display in the HTML field.

    I'm running DNN5.6.2 and DF3.4.5

    Don GeeUser is Offline
    river guide
    river guide
    Posts:273
    Avatar

    --
    06-30-2011 12:20 PM
    Hi David,
    Maybe you are doing more in your application to set this up than what you are explaining to me. To get on the same page let me refer you to a sample in www.betasprings.com. The login there is host, dnnhost. This sample might show you what you are trying to do. The sample is in Dynamic Forms > Calc4.

    The trick to getting a value to transfer from one field to another lies in working with client side events in the Advanced Field Options for the field value you are trying to transfer to the other field. Normally this is done with check box group field where you can address the CalculateCheckBoxListValues($(FieldName_FieldID), $(FieldName_ValueFieldID)).

    Now for your sample you may be summing a bunch of stuff and then tranfering from one textbox to anotheras you asked. Look at this code for the client side event in your Q1 advanced field options but rename Q1 to ($(TotalExtraonkeypress) as you need to use that reserved name then try the code below.  Make a field called GrandTotalHidden and then use that hidden field value in the HTML field:


    if(isNaN($(TotalExtraonkeypress))){
    $(TotalExtraonkeypress) = '0';
    }
    else
    {
    $(GrandTotalHidden) = formatCurrency(eval(parseFloat($(TotalExtraonkeypress)) ))

    document.getElementById
    ('GrandTotal').innerHTML = 'Your grand total comes to:  ' + formatCurrency($(GrandTotalHidden)) + '';


    }


    Good luck and let me know how it works.  I worked it out between just two text box fields.


    David AmmUser is Offline
    river guide
    river guide
    Posts:156
    Avatar

    --
    07-11-2011 08:51 AM

    Thanks for the feedback and example - that was very helpful.

    In the example Cacl4 I added a second html field (Total2) and tried to populate this using a client side event on the check box group. It works fine for the html field "Total" but not for "Total2". Any idea why?

    David AmmUser is Offline
    river guide
    river guide
    Posts:156
    Avatar

    --
    07-11-2011 09:05 AM

    Ok - I worked it out. The trick is to add the field id (i.e. short name) in the html source for the field.



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