Hi!
I’m trying to add express entries programmatically, but I got stuck with this problem. Entry is created, but attribute values are not saving and entry appears empty.
Thank you! Unfortunately persist changes did not help and the attributes became empty again.
I’m using this in pagetype controller. I just have a feeling I’ve done something wrong, but can’t figure out what! I’ll explain more about the case…
I have a page template for a page type, where I’ve added a basic HTML form for users to submit their contact info. Whenever an admin creates this page type, there is event to create new Express object specific for this page. It works fine.
When the form is submitted, I’ve used ajax to call function in pagetype’s controller:
I figured out I was using same attribute handles for every express object that I created. They need to be individual handles, even if using them in different objects.
So the problem was not adding the entry, but when I created the object.
@mandakosThedocumentation doesn’t explicitly mention that attribute handles must be unique, but you can see in all of the examples that the handles are prefixed with the object handle.
I ran into this problem myself, but got blocked when creating the objects through the Dashboard. It warned me that the handle must be unique. How did you manage to make the attributes with the same handles?
I was creating the objects programmatically in on_page_version_approve event. The object handle was created by page id to be unique. So at first I had this:
I was following the documentation, but didn’t notice there was unique handles for every attribute. I realized this after I tried to create object from the dashboard with these same attribute handles and it gave a warning as @Myq also said.