Dynamic dropdown revisited

Hi Stephanie,

This is a continuation of my topic Building a dynamic dropdown select box question. Comments were closed on that one, so I’m starting this new question topic.

I got the frm_setup_new_fields_vars add_filter statement to work perfectly in my functions.php file. It’s even doing the year calculations math which is great.

I found, however, that while those dynamic values do show up in the select box when we create a new record, they don’t show up when we go to edit a record.

Apparently, this occurred because I had removed the values I had manually entered into the select box field in the main drag-and-drop form editor thinking they were no longer necessary. To test my theory, I returned those original static values into the select box field via the drag-and-drop form editor, and sure enough, when I went to edit an existing record, the select box values were there again.

Question: Is there any way to edit a record created with select box values generated by the add_filter statement without having to hard code the select box options in the drag-and-drop form editor?

I ask because I’m trying to avoid the need to manually update the year information into these forms every January 01.

You need to also use the edit hook.
add_filter('frm_setup_edit_fields_vars', 'frm_set_checked', 20, 2);

By the way, you can reopen any of your own topics if you are logged in by clicking the link right below the last comment.

Worked great!

I had to change the function name so it didn't conflict with the first add_filter statement, but it works perfect. (EDIT: Oh, I see how to do it now without creating two separate functions.)

Thanks very much.

And sorry for missing the open/closed topic thingy. I'll remember that for next time. :)

Topic closed.