Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListReturn Alternate Data if nothing inputted into field - Need ExampleReturn Alternate Data if nothing inputted into field - Need Example
Previous
 
Next
New Post
8/24/2010 7:32 AM
 

Hi Sebastian

I've been working through the Forms and List Module (which I had actually never used before - very powerful) and am just a little stuck on rendering one of my requirements...

I have a field, Fax:, and the user should input a Fax number. But if they don't input anything, I'd like the module to return "not available" for this field. Bottom line, if a user doesn't input data, I'd like alternate data to appear. I looked in the module help and it says, "You can also add alternative text that gets returned if the requested value is null or empty: [Token:Property|Format|Alternative]." I don't quite understand this... Could you provide an example, please..?

BTW, I'm using my own HTML and CSS and the render engine to render an XSLT file for me.

Thanks
Jon


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
8/24/2010 11:37 AM
 
Jon, the form will always store a NULL value for missing input. However you can control the output in different ways. One way is to hide the value columns in list view, and to return them through calculated columns. In that case, the token replace syntax would be something like [columnname|{0}|not available].
If you use XSLT, you might want to replace statements like
<xsl:value-of select="udt:columnname"> 
with
<xsl:choose>
   <xsl:when test="udt:columnname!=''">
      <xsl:value-of select="udt:columnname" />
   </xsl:when>
   <xsl:otherwise>not available</xsl:otherwise>
</xsl:choose>
 
New Post
8/26/2010 7:40 AM
 

Hi Stefan (and Sebastian)

That's kinda the info I was looking for, thanks.

However - if you would entertain me on this one - I'm looking for something quite specific, and not sure if it's possible... Here goes...

I have a bunch of columns / fields and I want them inserted into a layout, like so:


<div class="wrapper">
    <h2>[Person's Title]</h2>
    <div class="foated-left">
        <h3>[Person's Name]</h3>
    </div>
    <div class="floated-right">
        <p>[Email]
        <br/>[Telephone]
<br/>[Fax]</p>
    </div>
</div>

Pretty straight forward. I've already gotten this one right - using the XSLT generator / wizard in the module. But, you'll notice that the contact details display in a <p> and each item is on its own line (done so by using <br/>). If there is no telephone number, I don't want the <p> to have a hanging <br/> at the end... Accordingly, I'd like to implement the following:

I don't know the XSL for this, but I'll try articulate...

<xsl:choose>
  <xsl:when test="udt:columnname!='[Telehone]'">
    <br/><xsl:value-of select="udt:columnname" />
  </xsl:when>
  <xsl:otherwise></xsl:otherwise>
</xsl:choose>

Where "<xsl:otherwise></xsl:otherwise>" would return nothing. i.e. no <br/>, no text, nothing.

Can this be done..?

Also, another thing I have noticed, is that when you try to insert a clearing div, like so: <div class="clear"></div> the XSL generator automatically inserts a non-breaking-space "&nbsp;". If I remove this, the layout breaks or simply doesn't work... What's the way around this..?

Thank you in advance.


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
8/26/2010 9:04 AM
Accepted Answer 
<xsl:choose>
  <xsl:when test="udt:Telephone!=''">
    <br/><xsl:value-of select="udt:Telephone" />
  </xsl:when>
  <xsl:otherwise></xsl:otherwise>
</xsl:choose>
or you use xsl:if as xsl:ortherwise returns nothing
<xsl:if test="udt:Telephone!=''">
  <br/><xsl:value-of select="udt:Telephone" />
</xsl:if>

 
New Post
8/27/2010 4:47 AM
 

Hi Stefan

Thanks for that - I got it working perfectly... Only thing I had to add was disable-output-escaping="yes" to the value select.

My only other unresolved is that when I try to clear my floats using:

<div class="clear"></div>

The resulting XML / XHTML source renders the <div class="clear">, but not the closing tag </div>... Odd. And "breaks" the layout.

The only thing that helps solve this is

<div class="clear">&#160;</div>

I'm not sure if this has to do with the XML doc declarations..? But, ideally, I'd like to be able to render this without a dodgy spacer sitting in the middle of nowhere... Do you have a solution perhaps? (Incidentally, <br/> renders as <br> - which is also not right.)

Thanks in advance
Jon


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListReturn Alternate Data if nothing inputted into field - Need ExampleReturn Alternate Data if nothing inputted into field - Need Example


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out