Load Featured Image into form
-
I have a form which uploads a featured image and other fields to a CPT. Once submitted, it redirects to another ‘load’ form taking the first form’s post id as input from the URL. I need to be able to show the featured image in the second form with fields below it to be updated/added. Is this possible?
Many thanks
Pete
-
Konrad, You’re probably fed up with me by now, but I’ve used the render to display only those fields I need, and it doesn’t include the Post_Title . When the form gets submitted, it is saving the post as the name of the page (and corrupting the page!).
Do I have to display the post title or is there a way to make sure the post title matches that of the form?
Thanks once more
Sorry about this, but I think I’ve found a bug the the presentation of a repeater field. It seem there are different css setting for each of the TR elements in the table. Watch this short video
**DELETED**
- This reply was modified 5 months ago by pzh20. Reason: MISTAKE
Please ignore the post above about a bug, that was my fault. So my only issue at the moment is the setting of the post_title or ID
Regards
Pete
Hello,
Thanks for the feedback!
I’m not sure to understand the issue with the post title. Please remember that I don’t work on your project, so I’m not aware of all your settings/customization. So you need to provide more information (help me to help you).
- What is the value of your “Render” setting?
- What is the current behavior?
- What is the expected behavior?
A json or php export of your Form and your Field Group would also help to quickly understand the issue, and avoid long questions/answers exchanges.
Regarding the Repeater field, all the CSS is handled by ACF itself. Your screenshot suggests you have some custom CSS rule somewhere in your theme which break the Repeater field render. In case of doubt, you can also try to install the native Twenty Twenty Two theme, and you’ll see the field will be rendered normally.
Thanks.
Regards.
I fully understand how difficult it is doing support, I’ve been in IT for many years and it’s always difficult, and I thank you for your support.
So I have a create post form where the user adds details of an uploaded featured image. The post title is created from two of the fields on the form which you helped me with earlier.
This is submitted and redirects to another form taking it’s input from the postId from the URL.
It displays the image, does some background processing to detect the faces in the image, and offers the user the chance to add the details of each person in the image.
It didn’t display the post_title, and when I submitted this form, it was saved as the name of the page the form is on! This not only was wrong, but meant the page was no longer editable as I believe the database was corrupted. I had to recreat the page before I could move forward.
I’m assuming I need some acffe hook to ensure the postId etc are the same as the postId that was passed.
Obviously, the save should save as the correct id and title, not the page it is on. Here is the json file link as I cannot upload files to this post.
acfe-export-form-add-photo-2-2024-06-23.json
The CSS is as I already said, ACF’s issue, and in fact resolved now.
Can you just go through the flow I should follow when doing an update form, do I need code to handle the update? I’m very impressed with this plugin so far and believe that it will be my solution going forward.
Regards
Pete
Hello,
Thanks for the details and the export.
It looks like the
{render:my_field}
template tags you use in the “Render” settings are malformed. Please pay attention to the syntax, there should be no space between the colon:
and the field namepost_title
. It should be all attached.In your settings, you use the following tags:
{render: post_title}
...
{render: featured_image}When it should be:
{render:post_title}
...
{render:featured_image}Also please make sure that you use the field name of the fields (the one you’ve set in your Field Group). So following your logic, you should have a field named
post_title
andfeatured_image
in your Field Group. Note you can also use field keys if you prefer, for example:{render:field_63458d5c5976c}
...
{render:field_6344284223a0e}Hope it helps!
Regards.
As all the fields render correctly with or without the space, I didn’t think that was the problem. Anyway, even after removing the spaces, the form is still saving as the Page Title not the updated post. What should I bs coding for after the submit so as to make sure the post id it’s youating is correct and terminating it if it’s not?
Regards
Pete
Hello,
You said earlier the Post Title field wasn’t displayed on screen. Is it correctly displayed now you use the correct syntax?
Regarding the “Post Update”, your Form export shows that you use the setting “Save > Target: Current Post”, so it will update the post where the form is displayed.
If you want to update the post id retrieved from the URL parameter
{form:photo_id}
, then you have set Target ={form:photo_id}
in the “Save” tab of your Post Action (Just like in the “Load” tab of your action), as shown on the guide I shared ealier.Regards.
Sorry, originately, I didn’t display the post_title, and wondered if that was why the post wasn’t being updated, and a new post with the name of the page instead. I added the post_tritle, but it’s still creating another post rather than updating it.
I do not want to update the ID i set the Post Action to Update (see Edit-Form-“Add-Photo-2”-?-The-Harrisons-Website-—-WordPress (2).png) and assumed the save should be the current post, being the post I’m updating. I’m obviously confused as to which post is being updated. I assumen that the post fields I’m changing would be the ‘current’ post, but the page is seen as the current post, doen’t seem logical to me. Anyway, I’ll change the Save Target to the {form:photo_id and give it a go.
I’ll let you know.
regards
Pete
No problem. Yes in the ACFE Form logic, “Current Post” means the current post/page where the form is rendered.
For example if you display the form on a page called
/my-dashboard
, the “Current Post” setting will understand you try to save values/load values frommy-dashboard
.Since WordPress isn’t aware of your custom URL parameter implementation
/my-dashboard?my-custom-id=42
, you need to set it somewhere to make it understandable for the form.This is where using Template Tag in Target/Source goes into action. It should now work if you set the “Save > Target” to
{form:photo_id}
.Thanks.
Regards.
Thank you Konrad, when I get back to work on Tuesday, I will buy a license, even though I think I can do all I need with thr free version, the support you’ve given deserves me buying a license.
So far, it all works. I’m going to need to read the documentation more to understand where I need code and wher the form works without any, otherwise, it works fine.
I now just have to update my javascript to deal with the differences with your code and Frontend Admin which I’ve been using. Following that, I expect I can use the form in a Bricks Builder version of the same site which I’m moving to.
Thanks again and have a great evening
Pete
It should be working with Bricks, using the
[acfe_form]
shortcode for example. I don’t have any report of incompatibility with it.Thank you, but if you don’t need the pro version, you don’t have to buy.
If you want to show your support, feel free to post a review, it’s more than enough and it’s always much appreciated!
Have a nice day!
Regards.
- You must be logged in to reply to this topic.