• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Attempting to create checkboxes dynamically

Attempting to create checkboxes dynamically 8 months 3 days ago #42945

  • nathan82
  • nathan82's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi,

I am attempting to create a group of checkboxes dynamically based upon a prior selection that filters the items to be displayed as checkboxes. I have been able to filter and render my checkboxes as I require so that the html looks just like a similar checkbox group created in the usual manner. I started my own function based on this, www.rsjoomla.com/support/documentation/r...e-form-example-.html

My issue is that my rendered checkboxes do not have a RSF JS event attached to them so that when one of my generated boxes is ticked RSF processing that is normally triggered on the change in the selection is not occurring. My checkboxes will have prices attached to them therefore I need the normal processing to execute.

The JS event that is not being attached is found in ..\media\com_rsform\js\script.min.js
function() {
  if (typeof func === "function") {
    func()
  }
}

Initially my Checkbox group creates this html from a field, access_items, created in the form the normal way however I have noting entered in the Items field.
<div class="uk-margin rsform-block rsform-block-access-items rsform-type-checkboxgroup">
    <label class="uk-form-label formControlLabel" id="access_items-grouplbl">Items Available</label>
    <div class="formControls uk-form-controls" role="group" aria-labelledby="access_items-grouplbl">
        <span class="formValidation">
            <span id="component271" class="formNoError">Invalid Input</span>
        </span>
    </div>
</div>

Upon selecting an entry from a prior drop down I trigger an 'onChange' action and my JS function executes and adds child elements to the above html to create this
<div class="uk-margin rsform-block rsform-block-access-items rsform-type-checkboxgroup">
    <label class="uk-form-label formControlLabel" id="access_items-grouplbl">Items Available</label>
    <div class="formControls uk-form-controls" role="group" aria-labelledby="access_items-grouplbl">
        <span class="formValidation"><span id="component271" class="formNoError">Invalid Input</span></span>
        <label id="access_items0-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items0" value="11" class="rsform-checkbox uk-checkbox">
        </label>
        <label id="access_items1-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items1" value="4" class="rsform-checkbox uk-checkbox">
        </label>
        <label id="access_items2-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items2" value="9" class="rsform-checkbox uk-checkbox">
        </label>
    </div>
</div>

While my 'control' checkbox group that I am using for comparison on the same form has html that looks like this
<div class="uk-margin rsform-block rsform-block-access-items rsform-type-checkboxgroup">
<label class="uk-form-label formControlLabel" id="access_items-grouplbl">Items Available</label>
    <div class="formControls uk-form-controls" role="group" aria-labelledby="access_items-grouplbl">
        <span class="formValidation"><span id="component271" class="formNoError">Invalid Input</span></span>
        <label id="access_items0-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items0" value="11" class="rsform-checkbox uk-checkbox">
        </label>
        <label id="access_items1-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items1" value="4" class="rsform-checkbox uk-checkbox">
        </label>
        <label id="access_items2-lbl">
            <input type="checkbox" name="form[access_items][]" id="access_items2" value="9" class="rsform-checkbox uk-checkbox">
        </label>
    </div>
</div>

Looking at the browsers Inspector I can see an event attached to each input element of the 'control' checkbox group that is not attached to the input elements of my generated elements.

Therefore my question is, 'How can I get that event added to my generated input elements?'

Terry
Last Edit: 8 months 3 days ago by nathan82. Reason: Added link to example article.
The administrator has disabled public write access.

Attempting to create checkboxes dynamically 8 months 3 days ago #42946

  • nathan82
  • nathan82's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hi,

I may have solved my own issue but I think it relates to the dynamic field not correctly adding the prices to RSFormProPrices correctly.

Terry
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!