Hello,
I have a bunch of fileds on my_form, all they are for states (just for example, am using states), say for example,
I have 4 fields, their names are and captions are as below
1) NEWYO_U, caption is New York UPD field (here, UPD is our business related terminology, pls. ignore it)
2) NEWYO_C, caption is New York CHK field (here, CHK is our business related terminology, pls. ignore it)
3) CALIF_U, caption is New York UPD field
4) CALIF_C, caption is New York CHK field
Already i have some JS piece in my_form INITIALIZATION and docReady events
1) LOOP all the FIELD objects (here they are as State names) in my_form , then check whether their name (NEWYO_U) possess '_U' 2 characters at the end? (if not existing '_U' 2 characters at the end, (example. NEWYO_C) then skip the validation, go to next loop/iteration/state)
if its existing (for example, NEWYO_U),
Them the JS has to find out its associated 'C'/'CHK' (NEWYO_C is the 'C' associated field for NEWYO_U field) field....we can achieve this task by truncating the original field from NEWYO_U to NEWYO into a temporary variable...............Then concatenating this temporarary variable of the the truncated NEWYO field with 2 characters of '_C' and making it to 'NEWYO_C' as its asscoiated field into a another temporary variable
If the NEWYO_U field DONT holds any data......then, make this its asscoiated 'NEWYO_C' field as HIDDEN.
If the NEWYO_U field holds the data, let make NEWYO_C field as visible
Actually, i can achieve my requirement by putting JS in each field objet's INITIALIZATION event itslef, but, i have 100 feilds in my_form, hence i would like to put at HEADER level by generically looping all the field objects in my_form in piece of code, for example. like below code snippet
Pls. provide me JS
Thank you
Views
Replies
Total Likes
Any help pls?
Thank you
Views
Replies
Total Likes
Any help pls?
Thank you
Views
Replies
Total Likes
Any help pls?
Thank you
Views
Replies
Total Likes
Hi,
here's a script that will search all fields which name ends with "_U".
function findNodes(vNode) {
if (vNode.className === "field") {
if (vNode.isPropertySpecified("name") === true) {
if (vNode.getAttribute("name").search(/_U$/g) !== -1) {
// Script to execute, when a match was found
...
}
}
}
for (var i = 0; i < vNode.nodes.length; i += 1) {
findNodes(vNode.nodes.item(i));
}
}
findNodes(xfa.form);
Views
Likes
Replies
Views
Likes
Replies