Hi.
I am in need of pre-populating a dropdown list in a repeating section with different values according to the row number.
Let's say I set up a repeating section with 1 dropdown(Type) containing 9 values(Type1, Type2, ... Type9) with the option to allow the users to add a new type if need be and one field with a checkbox(Present).
I need the first 9 rows that are static containing the items in the list.
Like this:
DropDown Found
Type1 checkbox row 1
Type2 checkbox row 2
Type3 checkbox row 3
...
Type9 checkbox row 9
Add new type checkbox row 10+
I have been partially successful but all values are the same Type on every row.
Not like this:
DropDown Found
Type1 checkbox row 1
Type1 checkbox row 2
Type1 checkbox row 3
...
Type1 checkbox row 9
Add new type checkbox row 10+
How do I setup a rule or use jQuery for this?
Thanks.
Solved! Go to Solution.
could you post code you use to populate dropdown with 'type1' value?
(it'll be faster to update your code then to start from scratch)
Hi Marian,
Type1 = "Ultram/Tramadol", Type2 = "Neurontin/Gabapentin", Type3 = "Paxil/Paroxetine"
We are in the process of purchasing Nintex at the moment.
It is expired but this is the rendition that only selected row 4.
This code only accounts for 3 set rows. I attempted a switch case. The if then statement had the same results.
I called this from a calculated field. It does get the row number properly but always defaults to last option.
//Show Current row number
function PopulateDDL(i){
//alert(i);
//var i = "";
//NWF$(".rsCONMEDNP").find("option:contains(Ultram/Tramadol)").attr('selected', 'selected');if (isNaN(i)) {
console.log("That was not a number!");
} else if (i = 1) {
NWF$(".rsCONMEDNP").find("option:contains(Cymbalta/Duloxetine)").attr('selected', 'selected');
console.log("..1");
} else if (i = 2) {
NWF$(".rsCONMEDNP").find("option:contains(Neurontin/Gabapentin)").attr('selected', 'selected');
console.log("..2");
} else if (i = 3) {
NWF$(".rsCONMEDNP").find("option:contains(Paxil/Paroxetine)").attr('selected', 'selected');
console.log("..3");
} else {
NWF$(".rsCONMEDNP").find("option:contains(Please select a value...)").attr('selected', 'selected');
console.log("...");
}
Case Switch did not work either
/*
switch {
case (i = 1):
//NWF$('.CONMEDNP).attr("value", "Cymbalta/Duloxetine");
alert("1");
//NWF$(".rsCONMEDNP").find("option:contains(Cymbalta/Duloxetine)").attr('selected', 'selected');return delay(1000).then(function() {
NWF$(".rsCONMEDNP").find("option:contains(Cymbalta/Duloxetine)").attr('selected', 'selected');});
break;
case (i = 2):
alert(2);
//NWF$('.CONMEDNP).attr("value", "Neurontin/Gabapentin");
//NWF$(".rsCONMEDNP").find("option:contains(Neurontin/Gabapentin)").attr('selected', 'selected');return delay(1000).then(function() {
NWF$(".rsCONMEDNP").find("option:contains(Neurontin/Gabapentin)").attr('selected', 'selected');
});
break;
case (i = 3):
alert("3");
//NWF$('.CONMEDNP).attr("value", "Paxil/Paroxetine");
NWF$(".rsCONMEDNP").find("option:contains(Paxil/Paroxetine)").attr('selected', 'selected');
break;
default:
alert("4");
//NWF$('.rsCONMEDNP').attr("value", "");
NWF$(".rsCONMEDNP").find("option:contains(Please select a value...)").attr('selected', 'selected');
break;
}
*/
}
PopulateDDL(2);
Edit: Wow-did not know replying to email made things look so bad. Tried clean it up a little.
I figured it out and it works nicely.
I am using this How to set the default value of a single line textbox to a calculation to lookup()
Just need to figure out how to hide/disable delete ability on just those rows.
I tried this bit it does not work.
It just deletes the added rows one at a time.
I ended up using that. Thank you.
I am still wanting to figure out how to just disable the the pre-loaded rows and allow the users to only delete the add rows.
I thought for sure the highlight would have worked.
CRFs
Thanks. I will look into the link thoroughly.
Using a rule would be ideal.
Essentially I just need to remove the "X" delete link from specific rows. I was hoping simple jquery would do it. I have done it in the past but that method did not seem to work here.
I have had some cases where I had to remove the delete if the values were a certain type. So in a list I might only be able to delete rows 1,2,6, and 9 and the other rows were only able to be deleted by someone else.
It will take a minute but I think I will get it.
it's quite easy if you base condition on a value that you have on a form.
but there is not apparent flag/value that would distinguish rows that were already existing at form opening to ones added during session. therefore that complexity.
but if you have simpler solution, I would be glad to see it.
True. I was hoping I could based on the rownumber and add a field to the lookup that would distinguish if delete is possible. Changing the values is a needed thing.
Ideally this is exactly what we need. As you can see the items with out an "X" are pregenerated and are not permitted for deletion. And the user can delete any the need to that they added.
It really seemed like this would have worked. This is as simple as I needed but I just need to get the call right.
NWF$.each(Textboxes, function(index) {
if (index == rowNum) {
NWF$(this).val(result);
if (rowNum <= 8) {
//alert(rowNum <= 8);
NWF$(this).find('.nf-repeater-deleterow-image').css("visibility", "hidden");
}
}
});