Read the Page Name of a Linked Page

Challenge

button on page A’s OnClick event links to page B.
If page B’s “PageName” variable contains the word “edit”
OnLoad change button text to “edit”.

Purpose

Dynamically change objects on the page based on keywords in the title to automate how certain objects are displayed. This would reduce human error and create consistency across common page elements.

Things I’ve Tried

1.

I tried using a repeater’s Reference Page “PageName” by using the conditions:

If [[Item.Link.PageName.indexOf(‘edit’)]] Set text on button equal to “edit”
If [[Item.Link.indexOf(‘edit’)]] Set text on button equal to “edit”

This didn’t seem to work, but would have achieved what I was trying to do.

2.

Note
Set text on button to [[Item.Link]] // Sets text on button to PageName of Item.Link

I tried to use the OnLoadVariable after discovering this…

Set OnLoadVariable to [[Item.Link.PageName]], Set text on button to OnLoadVariable // Displays as: “[[Item.Link.PageName]]”`
Set OnLoadVariable to [[Item.Link]], Set text on button to OnLoadVariable // Displays as “[[Item.Link]]”

Thoughts

The last idea I had, that I don’t really want to try, is to set a text field to [[Item.Link]] to be able to read the “PageName”.

I know you could probably do this programmatically with Javascript, but wondering if there’s a way to achieve this that I haven’t thought of. I’m relatively certain you can’t access event data as a variable, but perhaps there is another way to achieve this.

Don’t know if this is just over-complicating things, but this sort of thinking / automation helps when designing large 20+ page designs. (which I am, and sometimes do)

Hi, Josh. Is this what you’re going for? It uses the ability to set a reference page for a shape. The text on the shape is the name of the reference page (unless you change it).

Jeff

edit pagenames.rp (55.9 KB)

1 Like

Hi @Jeff_Harrison,
What I believe you used was a flow diagram, which would work for the example I gave, however the solution I’m after would ideally work with images and/or dynamic panels as well. That way I’m not limited to just text buttons.

What I’m trying to achieve is a way to read the “PageName” of another page so I can use that information as a variable on the current page.

No, there’s not any way to do what it sounds like you want to do. You can’t access actions you set on a widget like a property. Consider that a widget could have multiple pages it links to based on conditions

Thanks! I figured it would not be possible, but thought I would put feelers out there just in case.

This would potentially be a desired feature, where when linking to pages affects the current view. Dynamic panel states can kind of accomplishes this, it’s just a more manual process.