Issues with dynamic population of checkboxes in 2.4+ [RESOLVED]

I have been experiencing all kind of issues with dynamic population starting with 2.4.

My latest challenges revolve around populating checkboxes. I have used the code almost exactly as per the documentation site.

Say I have a checkbox field in the form with 3 choices/checkboxes. If I populate that field via code (gform_pre_render) with say 10 choices, the form will display the choices, but it will not save them all to the entry. Only the first 3 will be saved and anything beyond that will not.

It took me many hours to figure out why only partial selections were saved. I figured out that it has to do with how many (static) choices are present in the field. In this example, there were three.

One particularly strange thing is with the input IDs of the checkboxes. In the code, you are supposed to pass the choices and the input id in the form fieldID.inputID. The thing is that the input ID i specify in the code are not respected. The form seems to override the input ID/number I specify with 1-based values.

So if I start my input ID numbering at 127 for example, my actual checkbox input ID will be 1 in the form. I am thinking maybe there is the problem.

I have used dynamic population very often in the past, so I am pretty sure I am doing everything right.

Has anybody else noticed any issues since 2.4 or could you run a test and see if you experience the same issues?

I have tested this on 2 separate installations so far and I am getting same results. Unfortunately, I am not able to downgrade below 2.4 now that the database has been upgraded.

I recommend submitting this as a support ticket so we can look at your code and see what’s going on.

Thanks, I just have. I was hoping to maybe have some ideas faster than having to wait a day or so.

I’ll leave it open in case anyone has a suggestion.

I was able to figure this out with help from the support team.

The reason values were not saved after submission had to do with the condition that was checking for current page. The condition worked for display purposes but failed for submission purposes.

I changed the check so that it looks for the value of a certain variable instead of checking for current page number and everything works now.

1 Like

Thanks for the update.