Formatting

ellen.donovan's Avatar

ellen.donovan

23 Feb, 2016 04:35 PM

Hi,

I have a field in my DD that is required, If I uncheck that it is required, it messes up the formatting by wrapping an <h2> around everything. Instead of just not showing the h2. Could you please look at the code.

Attached is the code.

  1. 1 Posted by Ryan Griffith on 23 Feb, 2016 06:13 PM

    Ryan Griffith's Avatar

    Hi Ellen,

    You should be able to surround the <h2> with a conditional that checks to see if the heading has a value or not. Something like the following should do the trick:

    ...
        #set ( $heading = $directory.getChild("heading"))
        #if ($heading.value != '')
            <h2>$_EscapeTool.xml($heading.value)</h2>
        #end
    ...
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by ellen.donovan on 23 Feb, 2016 06:31 PM

    ellen.donovan's Avatar

    Yes, that did the trick. My attempt looked like this.

    #set ( $heading = $directory.getChild("heading") )
        #if ($heading.value != "")
        $_SerializerTool.serialize($heading, true))

    #end
    <h2>$_EscapeTool.xml($heading.value)</h2>

  3. 3 Posted by Ryan Griffith on 23 Feb, 2016 06:34 PM

    Ryan Griffith's Avatar

    Thank you for following up, Ellen. I am glad to hear my suggestion did the trick.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  4. Ryan Griffith closed this discussion on 23 Feb, 2016 06:34 PM.

  5. ellen.donovan re-opened this discussion on 23 Feb, 2016 06:43 PM

  6. 4 Posted by ellen.donovan on 23 Feb, 2016 06:43 PM

    ellen.donovan's Avatar

    Thank you

  7. Tim closed this discussion on 23 Feb, 2016 06:43 PM.

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

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM