Search the FirstSpirit Knowledge Base
Dear FS Community,
I have a GUI Script and I want to make sure a user selects the correct page template in a FS_REFERENCE in the script configuration.
Is there a rule for that so a user cannot save when she selects a different page template?
I started a rule below, but it does not work. What goes into <PROPERTY name="???", if I want the refName of the selected page template to be compared with the <TEXT> tag?
(I know, I could just hide the FS_REFERENCE so the user cannot change it when calling the script, but the user should not see the script config every time she executes it. The script config should just be changed in the Template Store.)
Any other ideas? Thank you!
FS_REFERENCE
<FS_REFERENCE name="sc_page_template" hFill="yes" imagePreview="no" noBreak="no" useLanguages="no">
<FILTER>
<ALLOW type="template"/>
</FILTER>
<LANGINFOS>
<LANGINFO lang="*" label="Page Template"/>
</LANGINFOS>
<PROJECTS>
<LOCAL name=".">
<SOURCES>
<FOLDER name="templates" store="templatestore"/>
</SOURCES>
</LOCAL>
</PROJECTS>
</FS_REFERENCE>
Incomplete Rule
<RULE>
<WITH>
<AND>
<EQUAL>
<PROPERTY name="???" source="sc_page_template"/>
<TEXT>refName</TEXT>
</EQUAL>
</AND>
</WITH>
<DO>
<VALIDATION scope="SAVE">
<PROPERTY name="VALID" source="sc_page_template"/>
<MESSAGE lang="*" text="The page template needs to be 'refName'."/>
</VALIDATION>
</DO>
</RULE>
Hi Eric,
Hm, it's still a bit confusing, to be honest. It surely would be possible, to programmatically check the existence of the templates from within the script (without a form) and display a notification (or maybe a form), in case one or more of those templates do not exist.
As I said, this is not possible with a rule. But in a script, you can always also validate the selection after the dialog is confirmed. I agree, though, that this is not the best UX to have multiple dialogs.
Not sure, if this helps in any way. Maybe someone else in the community comes up with a better idea.
Best regards
Stefan
Hi Eric,
I just checked this out. Unfortunately, there is no property at the moment to get hold of the reference name for a FS_REFERENCE component's selection.
Feel free to open a feature discussion, as this would actually be a small change in FirstSpirit.
Best regards
Stefan
Hi Stefan,
I was looking more for a different solution than a definite that it does not work. Any ideas? Thanks!
Hi Eric,
Ok, stepping back from the technical question.
What is the actual requirement you are trying to accomplish with the template reference? It seems strange to have a form / field displayed that a user actually should not edit.
Best regards
Stefan
Hi Stefan,
indeed a valid point :smileygrin:. Let me go back: we are running a content-creating FSM on the server that is called by a GUI Script. The GUI Script is configurable in the sense that a user needs to select where the created content should be published to. Also we have templates that should be set.
My idea was here: the user should select those templates to ensure the templates do in fact exist in the project. I know, I could just check that during FSM runtime, but I consider it easier understandable for the user to get immediate feedback when setting up the config instead of reading logs during runtime.
But, maybe you have a more elegant solution? Thank you!
Hi Eric,
Hm, it's still a bit confusing, to be honest. It surely would be possible, to programmatically check the existence of the templates from within the script (without a form) and display a notification (or maybe a form), in case one or more of those templates do not exist.
As I said, this is not possible with a rule. But in a script, you can always also validate the selection after the dialog is confirmed. I agree, though, that this is not the best UX to have multiple dialogs.
Not sure, if this helps in any way. Maybe someone else in the community comes up with a better idea.
Best regards
Stefan