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!

Need to store the value of the chosen checkboxes
Last Post 10-08-2013 07:15 AM by Ryan Bakerink. 10 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Mark BuelsingUser is Offline
river guide
river guide
Posts:241
Avatar

--
09-24-2013 02:11 AM
    My form has several checkbox groups and I am storing the user's choices in a table. Please tell me how to grab the user's choices from a checkbox group. Everything I have tried has not worked.

    for example, the checkbox group's short field name is "VocalistNo2SongChoices". I have tried $(VocalistNo2SongChoices) and $(VocalistNo2SongChoices_Text) and $(VocalistNo2SongChoices_FieldID). These have not worked. What is the right way please?

    Is it easier with a list box? I need multi select if so.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    09-24-2013 12:15 PM
    Hello Whetstone,

    If "VocalistNo2SongChoices" is the short field name then the following token should display all selected checkbox values in a comma separated list:

    $(VocalistNo2SongChoices)

    If this is not the case can you please verify the version of Dynamic Forms that you're using? Also what's the DNN version.

    Please let us know if you have any questions.

    Thanks,

    Ryan
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    09-24-2013 01:09 PM
    Thanks for your reply Ryan.

    Dynamic Forms 4.10.0 and DNN 6.1.2.

    I am testing the ability to grab the value of the check box group by using a client side event to put the value into another textbox so I can see it. It is returning "undefined" when it is run even with check boxes chosen.

    $(SongList)=$(VocalistNo2SongChoices);

    Maybe that helps diagnose it?
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    09-25-2013 03:24 AM
    What does "undefined" mean?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    09-25-2013 05:41 AM
    Hello Whetstone,

    This just means that the checkbox values can't be determined.

    Go to Module Configuration -> Advanced Coding Options - > Custom JavaScript File and add this JavaScript function to the file:

    ------------------------------------------------------------------------

    function GetCheckboxGroupValues(CheckBoxList)
    {

    var objChkBoxLst = document.getElementById(CheckBoxList);

    if(objChkBoxLst)
    {

    var objChkBoxes = objChkBoxLst.getElementsByTagName('input');
    var objChkLabels = objChkBoxLst.getElementsByTagName('label');
    var i;
    var CheckedValues = '';

    for(i=0;i {

    if(objChkBoxes.checked)
    {
    CheckedValues += objChkBoxes.value + ',';
    }
    }
    }

    CheckedValues = CheckedValues.substring(0, CheckedValues.length - 1);

    return CheckedValues;

    }

    ------------------------------------------------------------------------

    Save the Custom JavaScript file. Then be sure to completely refresh the page by combining CTRL + F5. May be a different combination depending on the computer you're using.

    Your JavaScript of assignment should now become:

    $(SongList)= GetCheckboxGroupValues($(VocalistNo2SongChoices_FieldID));


    Give this a try and let me know if this gives you a comma separated list of the selected values.

    Let me know if you have any questions.

    Thanks,

    Ryan
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    09-25-2013 06:15 AM
    Ryan, thanks again for your help. I pasted in the new javascript function and changed the client side event to call the function like your example. I get nothing in the textbox at all when I trigger the Client Side Event.

    Is this function tested or just written? Is this normally already in the form's javascript collection? It wasn't in mine.
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    09-25-2013 06:18 AM
    Does this have to draw upon a saved record? In my case, all this needs to work before the form is saved.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    09-30-2013 05:05 AM
    Hello Mark,

    I created a new JavaScript function that was the same as a pre-defined function in the Custom JavaScript file, but then re-purposed it to work as you needed.

    I made small tweaks, so this should be working if you're using this as I instructed above.

    If this isn't working, this means that you'll need to begin some debugging to locate the issue. You can use Google Chrome Inspector, FireBug for Firefox, or provide me with a URL to this page.

    Please let me know if you have any questions.

    Thanks,

    Ryan
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    10-01-2013 04:29 AM
    Ryan, thanks for looking at this. URL and credentials have been sent to you through your contact form.
    Mark BuelsingUser is Offline
    river guide
    river guide
    Posts:241
    Avatar

    --
    10-02-2013 08:17 AM
    Thanks Ryan for your help and solution!! We are now able to get the values of the checked lines of a Checkbox Group before the form is submitted.

    The solution was to call the new function like this in a client side event:
    $(SongList) =

    CalculateCheckBoxListValues_NEW
    (
    $(VocalistNo2SongChoices_FieldID),
    $(VocalistNo2SongChoices_ValueFieldID)
    );


    The javascript functions that get the values of the checked lines of a Checkbox Group are:

    function CalculateCheckBoxListValues_NEW(CheckBoxList, CheckBoxValField) {
    var objChkBoxLst = document.getElementById(CheckBoxList);
    var objChkBoxVals = document.getElementById(CheckBoxValField);
    var arrChkBoxVals = '';
    var CheckedValues = '';

    if(objChkBoxVals)
    arrChkBoxVals = objChkBoxVals.value.split('|');
    if(objChkBoxLst) {
    var objChkBoxes = objChkBoxLst.getElementsByTagName('input');
    var i;
    for(i=0;i if(objChkBoxes.checked)
    {

    CheckedValues += GetCBValue2(i, arrChkBoxVals) + ',';
    }
    }
    }
    CheckedValues = CheckedValues.substring(0, CheckedValues.length - 1);
    return CheckedValues;


    }

    function GetCBValue2(intIndex, arrChkValues) {
    if(arrChkValues)
    {
    var i;
    var arrTempVals;
    //var numRetVal = 0;
    var CheckBoxes = '';
    for(i=0;i {
    arrTempVals = arrChkValues.split(':');
    if(arrTempVals)
    {
    if(arrTempVals[0]==intIndex)
    {
    CheckBoxes += arrTempVals[1] + ',';
    }
    }
    }
    CheckBoxes = CheckBoxes.substring(0, CheckBoxes.length - 1);
    return CheckBoxes;
    }

    }

    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-08-2013 07:15 AM
    Thank you for posting the solution.

    Hope you have a great day, let me know if you have any questions or issues.

    Thanks,

    Ryan
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • 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