WendyShoef
7 years agoQrew Cadet
Javascript to find and replace and then update fields
I have a 2 part issue:
Using the [iol] method, I have a mod.js file and am calling it in my form.
Issue #1:
I am able to retrieve the data in some of the fields using
var intro = _fid_15.value;
However, using var name = _fid_66.value; does not work.
Upon inspection, there isn't a field with id _fid_66 even though the data is being displayed. There is a label for="_fid_66" with a subsequent div following with the info. The div has an id of "tdf_63" (which I am assuming is the 63rd field on the form as the field next field is tdf_64 and the one after that is tdf_65).
Using getElementById().label does not work as there isn't an element with _fid_66.
We are in constant development right now and there is absolutely no guarantee that the fields will remain in the order they are in (in fact I can 100% assume not).
Question #1:
How do I get the value in this div into a variable without knowing the exact number on the form?
Issue #2:
Ignoring issue #1, I have changed "var intro" and now want to put the new value back into the field.
Using "var intro = _fid_15.value;" I then change the value. Then using "_fid_15.value = newValue" and saving the form (via saveAndKeepWorkingMenuOption.click();).
Updated value does not get saved.
Question #2:
What step am I missing to change and save the data?
Using the [iol] method, I have a mod.js file and am calling it in my form.
Issue #1:
I am able to retrieve the data in some of the fields using
var intro = _fid_15.value;
However, using var name = _fid_66.value; does not work.
Upon inspection, there isn't a field with id _fid_66 even though the data is being displayed. There is a label for="_fid_66" with a subsequent div following with the info. The div has an id of "tdf_63" (which I am assuming is the 63rd field on the form as the field next field is tdf_64 and the one after that is tdf_65).
Using getElementById().label does not work as there isn't an element with _fid_66.
We are in constant development right now and there is absolutely no guarantee that the fields will remain in the order they are in (in fact I can 100% assume not).
Question #1:
How do I get the value in this div into a variable without knowing the exact number on the form?
Issue #2:
Ignoring issue #1, I have changed "var intro" and now want to put the new value back into the field.
Using "var intro = _fid_15.value;" I then change the value. Then using "_fid_15.value = newValue" and saving the form (via saveAndKeepWorkingMenuOption.click();).
Updated value does not get saved.
Question #2:
What step am I missing to change and save the data?