On 5/4/07, Maria Gwyn McDowell <[EMAIL PROTECTED]> wrote:
> Johan,
>
> Thanks.  Unfortunately, your suggestion only allows divs to exist
> based on a single field.

*puzzled* Did you mean ex:if-exists=".instructor" AND
ex:if-exists=".coursenumber"? That is a lot easier, in that case:

<div ex:if-exists=".instructor">
<div ex:if-exists=".coursenumber">
Then create this div
</div>
</div>

> I am creating a container div with a header that will contain
> a number of fields (also if-exists statements), but I only want the
> container to exist if at least one of the fields has content.

My solution did that, at the expense of creating duplicates (or more,
if you had, say, ten properties, either of which should show the
header) when more than one condition was fulfilled. So when I wrote

<div ex:if-exists=".instructor">Then create this div</div>
<div ex:if-exists=".coursenumber">Then create this div</div>

I actually suggested that you would copy *all* the stuff (including
other if-exists statements), possibly screenfuls of it, to all places
where there is an "Then create this div" above. Very untidy and not
nice to maintain when you make changes to that staple code (as you'd
have to make the same modification in multiple places), but it should
at least work.

With the mentioned misfeatures.

-- 
 / Johan Sundström, http://ecmanaut.blogspot.com/

> If no fields have content, no container div, no header.  It is of
> course, the more complicated version. Sigh.
>
> Thanks,
> Maria
>
>
> On 3 May 2007, at 5:47, Johan Sundström wrote:
>
> On 5/3/07, Maria McDowell <[EMAIL PROTECTED]> wrote:
> Folks,
>
> Is it possible to do something like this:
> <div ex:if-exists=".instructor" OR
> ex:if-exists=".coursenumber">Then
> create this div</div>?
>
> It is, but not prettily; you could copy and paste a bit, but it will
> give you duplicates if both exist:
>
> <div ex:if-exists=".instructor">Then create this div</div>
> <div ex:if-exists=".coursenumber">Then create this
> div</div>
>
> There might (should) be better ways too, I hope. :-) David, would it
> be feasible to concoct something like an ex:if="exists( .instructor )
> || exists( .coursenumber )" or perhaps ex:if="or(exists( .instructor
> ), exists( .coursenumber ))" to do this kind of thing? I don't think
> straight at the moment, so I can't quite tell myself. (These two
> suggestions don't work yet, but likely could be made to.)
>
> --
> / Johan Sundström, http://ecmanaut.blogspot.com/
>
>
> In short, I know I can make an individual field appear IF the field
> exists in the item.  But what if I want to make a div appear only if any
> ONE of three or four fields exist?  Is this possible?  What is the
> syntax if it is (remember: non-developer asking this question).
>
> Thanks,
> Maria

_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general

Reply via email to