Comments

I had the same issue a while back, and the solution was a real headache but still doable. If anyone knows a better way to do this, I'm all ears.

Basically, you have to use the entire HtmlCollection that gets returned and figure out which numbered index to reference for your data. What I did was enable the Show Row Number option of the subform, hide it using CSS, then relatively reference that element based on whichever event fired the JavaScript in question. Once I had that element, I could parse the value and get the row number. Now, take the row number as the index of the HtmlCollection array and you may hopefully find the current element, but I remember running into a few issues with hidden templated rows which threw off the HtmlCollection object, so I needed to refine my CSS query to only grab visible elements matching very specific criteria.

Another option is to relatively reference the element in question based on the event fired by the JavaScript, but my case was a bit different and there were dynamic fields preventing me from referencing it directly, hence the HtmlCollection array solution.

I apologize that I couldn't find a way to add indents from the clipboard on these forums, so this may be a bit hard to read. Also, I only took portions of my code, so it may have a missing function or there may be unused functions floating around below.

function CopyValueOfDropdownToAnotherField(input, cssClassOfThisField, cssClassOfNewField, options) { // USAGE /* * Create a repeating subform. * Create a dropdown list inside the subform which has a lookup to a name/value pair. * Create a text box which will hold the value associated with the dropdown selection. * Edit the text box and set the Field CSS to some unique string. Copy this class name into the final step. * Edit the dropdown list and go to the appearance tab. In the Field Css, type a unique CSS class that you won't find anywhere else on the page. * Now go to the advanced tab. Edit the JavaScript Event to "Change", and paste the following line into the JavaScript Function while editing the value in quotes to the CSS class from above: * CopyValueOfDropdownToAnotherField([this], "InputDropdownForFirstLookupField36", "PutDropdownValueIntoThisCascadingLookupField4", "Fire) * If you want the dropdown text instead of the hidden value, add a boolean true as the last parameter. */

try { var dropdownNode = input[0]; } catch(e) { console.log("Don't set up CopyValueOfDropdownToAnotherField() from a rule; set it up from the field's Advanced tab using JavaScript options."); return; }