Help with Checkbox in List Field

Happy Saturday!
So I’m working on a fairly tough thing that is ALMOST done, but I’ve hit another snag and hoping folks might have some thoughts. I have a list field with a LOT of custom stuff going on:
image

It auto-populates and even changes field type from text to checkbox using:

add_filter( 'gform_field_content_35_53_13', function ( $field_content, $field ) {
          return str_replace( 'type="text"', 'type="checkbox"', $field_content );

  return $field_content;
}, 10, 2 );

BUT when I change the page, the second checkbox loses its “:checked”

image

Any thoughts on why that would be? Thanks!

A thought, is there a way to do a:

jQuery(document).ready(function($) {

});

But for a Gravity Forms Page? I’m currently working with gform_page_loaded but haven’t had any luck.

For the jQuery part you could use the gform_register_init_scripts action.

Without knowing the underlying code etc. from what I see the above fields are filled in, but the fields in the second aren’t. Which could explain why the checkbox is unchecked (‘empty’) too.

1 Like

I think this issue is bigger than what I thought and not related to checkboxes or my jQuery at all. It appears to be an odd conflict with dropdowns in a list field over 12 columns. I’ve seen similar when using the drop down plugin. the User Interface seems to muck things up:

What I am seeing is that in my 13 column list field, starting on row two, it seems to shift the data back by one. On row three it get’s shifted by two, and row four it gets shifted by three.

image

So 13 is not my lucky number! I even then tried to add a 14th and it still throws the error. When I remove that column, the issue sometimes goes away.

To find the error I have… completely removed my jQuery scripts, systematically disabled my snippets, ran through my plugins and disabling and enabling them one by one, and recreated a test form. I then dismantled the test form until I narrowed it down. It has been a sucky week trying to find this.

In the test form, initially, it does allow all 13 columns with pagination. the dropdown UI seems to gunk it up at a certain point. I’ve contacted the creators and am hoping for some help, otherwise I need to find a crafty work around… Oi… I have my test form back up with a sample of it on there if anyone is interested.

https://goadrifttravel.com/00-test/

Ah! That indeed explains the empty checkbox too, since that somehow wouldn’t get a value and thus not checked.

What are you using for adding / reordering the rows? Anyway, I’d love to take a look, but getting a “doing a routine backup” page currently so I’ll check back later :slight_smile:

1 Like

Doh, just changed that if you want to take a look. I’m just using the free sortable fields on the plugin search. It’s made by the same person, Adrian, who made the drop downs. It seems to work well.

There is a bug in GF versions 2.4.5.3 and earlier where some list field values may not be posted by the browser on form submission if the column label included special characters. This was fixed in version 2.4.5.4, the latest build is available from the downloads page.

2 Likes

Thanks! I’ll take a look at that. I did notice a difference between browsers. Problem is I also notice that my jQuery sometimes runs in Chrome when it wont in explorer/edge.

Soo, I guess we’re in different timezones… :wink:

I’m getting a login screen now :grimacing:

2 Likes

Sorry Hiranthi, I can’t find the reason for its block and will have to look into that later. It was working last month and I don’t have issues with other similar setup pages. I am wondering if Ultimate Member did an update that is causing the display issue, but for now it’s not that important.

In other news I think I’ve partly resolved the problems. I’m not 100% sure what gunked up the code, but it is possibly multiple things did. In any case, I’ve gotten things to work a little better leaving cell13 as a text field and made it read only. I also plan to add some conditional attributes. Maybe someday I’ll come back and readdress this to improve my system/form.

@Chris, you can close this thread. If/when it gives me any more trouble I’ll start another one.

Thanks all!

2 Likes