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)