Get last entry from a field

By: Gregory Tulipani | Asked: 11/23/2023
ForumsCategory: General questionsGet last entry from a field
Gregory TulipaniGregory Tulipani asked 5 months ago

I have a function I'm trying to accomplish where a field will default populate with its latest entry. I know I can use the code field_id=x, however I have to duplicate this field over one thousand times throughout the course of 200 forms and updating the field ID every single time will be incredibly time consuming. Is there a broader command for this function? Something like entry_id=last or something?

1 Answers
Victor Font answered 5 months ago
Since you mention this is a 200 form course and you want the field value duplicated across all 200 forms, you'll need to explain a little more. What is this field? What does it capture? Are the users registered and have WordPress IDs? Are you capturing user id in your forms? How are course users registered? Are you using Formidable's registration add-on? The more you can explain your process and expected results, the better it is for someone to understand what you're trying to accomplish.
Gregory TulipaniGregory Tulipani replied 5 months ago

It's for a tournament registration system. Basically, a player inputs their selection of what they will be using to compete with in that field, and after they submit, the form will reload and leave their entry in the field as a visual confirmation. But it's a large tournament with 200 teams (approximately 2,000 players). So I was hoping there could be a broader command than entering it's own field ID in order to get this effect. Because when I duplicate the form for each team, I have to update this field ID number every time. Each form is essentially a "team center", where the 10 players of that team update their selections in each designated spot of the form every week.

Victor Font replied 5 months ago

You're displaying this value in "as a visual confirmation". Why are you using a field if it's meant only as a visual reminder? Are the user's allowed to change the value after it's been submitted on the first form?

Gregory TulipaniGregory Tulipani replied 5 months ago

Yeah the users can change the value after submitting.

Victor Font replied 5 months ago

So, you want to carry the value forward until a user changes it in a subsequent form, then carry the new value forward until it is changed again in a different form?

I'm concerned about why you need to keep duplicating a form. When you duplicate an entire form, every field ID and key changes. This means any custom code that may be required to provide the functionality you need won't be able to be built ensuring software portability. Duplicating forms is a problematic design. Why can't you do this is in just one form? Can you share your form design so we can get a picture of why they must be duplicated? It seems a tad over engineered.

Gregory TulipaniGregory Tulipani replied 5 months ago

The issue comes from the nature of the tournament type.

Its a team tournament where a team is comprised of 11 players and 7 are assigned by a captain to compete each week. As it is now, i have one form for the captain where they assign a player, and then those selections for the week are carried over to seven player forms for them to fill out. That data writes to google sheets, and then is redisplayed on another section of the site. Its a very complicated tournament. Its like two layers of fantasy football stacked on top of eachother where a manager changes a team around and then each team member can change their game selections.

The only way i have made this work, and it has been working, is each team gets their own dedicated built team page. Thats why ive been duplicating forms and re-updating each reference manually.

Victor Font replied 5 months ago

There's got to be an easier way to design this without all the form duplication. I don't even know how you'd be able to create reports from that spider-web design. Nevertheless, I don't know of anyway to do what you want without a custom coding solution. You could try creating a custom shortcode that could be used for every form, even the duplicates. You would need to pass identifying parameters to the shortcode to ensure your pulling back the right value.

Without hands-on to your system, I'm not certain what variables you would pass or how you would retrieve the proper value. Perhaps when this tournament is over, maybe you'll consider engaging a developer o help with a more fluid design to make things easier?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right