Empty node
For an emergency alert page, I'm trying to produce a default date and text when no update to the alert has been entered. I'm grabbing the current date successfully but, for reasons unknown to me, my if/else statement is not working. The if-statement in the script works--if the date node has a value. If no value for date is present, the else statement is not working.
I'd appreciate any help.
Jim
- script.txt 1.15 KB
- page.xml 2.25 KB
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on Apr 29, 2013 @ 07:02 PM
Hi Jim,
There are a few items I noticed with your Format that may be causing problems:
$updates
is inside of your#foreach
, so this means there will always be at least one and the else portion of the conditional will never fire.#foreach
iterates; it would be much more efficient to create this variable once before looping and simply re-use it.Try the following Format as a starting point and let me know how it works out for you:
Please let me know if you have any questions.
Thanks
2 Posted by steelej on Apr 29, 2013 @ 08:00 PM
Thanks Ryan. That makes sense and works.
Jim
3 Posted by Ryan Griffith on Apr 29, 2013 @ 09:02 PM
Not a problem at all, Jim, thank you for following up. I am glad to hear that did the trick.
Have a great day!
Ryan Griffith closed this discussion on Apr 29, 2013 @ 09:02 PM.