As I understand it, this is a way to not display a field if it is left blank. If the field is blank, it is NOT supposed to output the beforetext and aftertext.
However, mine is firing the beforetext and aftertext. So what am I doing wrong?
Rhythmyx 6.5.2
Also, as an aside, I noticed that in the documentation, it is referenced as #field_is_set(fieldname, beforetext, aftertext) but in the snippet bin, it builds the field as #field_is_set(beforetext, fieldname, aftertext). The latter appears to be the correct implementation, as I got nothing with the former.
That’s good to know, but that doesn’t solve my root problem, which is that it doesn’t appear to be working correctly. For the page that does not have that field filled out, it still puts the beforetext and aftertext.
The current field_if_set does not work with EditLive fields, since as mdmcginn noted, the editor adds code even if the field is not touched. As such, the field is never blank, so field_if_set always fires.
The solution I came up with was to build a separate field_if_set macro, using the same principle of the displayfield macro, which is basically to strip out everything but text, then check the field. The macro looks like this:
I found a bug describing similar behavior that was patched in Version 6.5.1, but I was able to reproduce your behavior in an unpatched 6.5.2 installation. I was not able to reproduce it in an internal build of the latest code being developed for the next release. I’m not sure whether this is a bug that was patched or it is a problem resolved in the latest version of the EditLive DHTML editor.
Either way, Tech Support should be able to help you find a resolution.
The behavior of the ephox control was changed recently (but I don’t remember exactly when) for a different, but related reason. Previously, if you had a ‘Required’ validation on an ephox field, it never fired, even though it appeared the field was empty and you had never entered anything. This was due to ‘hidden’ text that was visible in the Code tab. Now, this text is stripped on submission if no data is present. This change would probably resolve the issue noted here.
So that’s why I’m trying to test for a few different variations of an empty field. They’re not empty but they render as whitespace on the page. But if I carry on with this approach I’m going to have to test for all possible HTML combinations that render as whitespace.
The code you mentioned (xmlns:st2=“urn:www.microsoft.com/smarttags2”…) appears in Ephox when users cut and paste directly from Word - Word switches on smart tags by default and it is a real pain. Advising users to use the Paste special -> plain text menu option is one way to ensure that code does not appear but it does rely on users adhering to guidelines.
Is there any way that Rhythmyx could be configured to strip out the Microsoft code automatically in a future release?
Thanks for the code, but it is already in our Ephox config files… we are not getting the “xmlns:st2” namespace errors any more but some Word formatting still shows up on occasion, along with some "<designstimesp…> code which we blame on users pasting directly into Ephox!
This behavior has been logged as a bug for Rx 6.5.2 and is scheduled to be addressed in a future version of the product. The workaround for the time being is posted below.
Thanks!
In the workbench, go to the System Design tab > Configurations >
double-click on User Velocity Macros. This will open the rx_assembly.vm
file.