Programmatically set Custom Page Attribute Value?

Any insights anyone can share this are deeply appreciated:

  1. I’ve created a front-end form that enables my client to create new records in a Express Entity.
  2. That Express entity has been added as a custom attribute to the home page of the client site in order to display content
  3. I’d like to be able to add a checkbox to the front-end form that sets the custom Express Entity attribute on the home page to the record on submission

As always, many thanks all!

Hello.
I’m not sure I understand. How would that work?
I fill in the front end form which creates a new entry. You want the page attribute to reference the latest entry, correct?
How would the checkbox help with that?

I think the checkbox on the front-end form would be like “Make this a featured entry on the home page” and then if it were submitted, that would auto-update the attribute associated with the home page to the value of that row in the express object.

yes, that’s exactly what I’m trying to accomplish.

After a few days of noodling around with this, I think I’ve found another approach. But I still need some help figuring out how to programmatically set a custom page attribute on the site’s home page. Thoughts, anyone?

This is a good place to start:

Once you’ve had a look through there, if anything is unclear, just update this thread.

1 Like

There are some conveinent cheat sheets for this kind of thing. Try

When using a cheat sheet, its usually worth double checking to make sure what you are reading is up-to-date.

1 Like

Several complete re-writes later, I’m marking this as resolved.

It turns out that the best way to handle the content associated with the custom Express Entity Attribute on my client’s homepage is to actually publish this content to a custom page type.

By adding a custom checkbox attribute to that custom page type, I’m able to incorporate a checkbox on the Compose form for that page type. I was then able to add code to the page header for that custom page type that checks for that checkbox value and executes if it’s been checked.

If the checkbox is checked, the code resets the custom attribute on the homepage. It’s a little cumbersome, but it meets requirements.

As always, thanks for the advice!

2 Likes