You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by matra <ma...@gmail.com> on 2006/05/04 22:19:54 UTC

cforms: wizard lookup (popup)

Hi,

In a cocoon form, how is it possible to mimic the functionality of date
fields/calendar-popups

i.e. have an img next to a field, when clicked, a new window will popup 
containing some kind of a wizard (possibly another cocoon app). Uppon 
submission (of the wizard) the calculated value should be sent back to the field

for example, lets say that we have a zip-code field. and we like to offer 
a popup wizard where the user will enter the street address 
(in text or in an imagemap) and we will come up with the proper zip-code

TIA
-km





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cforms: wizard lookup (popup)

Posted by matra <ma...@gmail.com>.
Victoria Vitaver <victoria <at> tt.com.au> writes:

> 
> 
> sure, as a default I think there is a calendar pop up attached to all fields
> of type date (correct me if I'm wrong)
> In our project we have overwritten this behaviour  in our
> forms-samples-styling.xsl, so that a field of type date, gets translated
> into a field which is attached to a javascript event which controls
> behaviour of the pop up.
> 
> Here is our code from forms-samples-styling.xsl, this is basically a copy of
> the code already provided modified to suit us. (Notice our javascript
> function is named displayCalendar())
> 
> HTH,
> Vica
> ___



Vica

thanx for the tip. It makes - a lot of - sense.
I suppose the value from your displayCalendar() function
gets back through javascript (i.e.
window.opener.document.getElementById("firstname").value = '#fname#';)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: cforms: wizard lookup (popup)

Posted by Victoria Vitaver <vi...@tt.com.au>.
sure, as a default I think there is a calendar pop up attached to all fields
of type date (correct me if I'm wrong)
In our project we have overwritten this behaviour  in our
forms-samples-styling.xsl, so that a field of type date, gets translated
into a field which is attached to a javascript event which controls
behaviour of the pop up.

Here is our code from forms-samples-styling.xsl, this is basically a copy of
the code already provided modified to suit us. (Notice our javascript
function is named displayCalendar())

HTH,
Vica
___

<!-- Custom calendar styling -->
  <!--+
      | fi:field or fi:aggregatefield with either
      | - explicit styling @type = 'date' or
      | - implicit if no styling @type is specified,
      |   but datatype/@type = 'date' and datatype/convertor/@variant =
'date',
      |   selection lists must be excluded here
      +-->
  <xsl:template match="fi:field[fi:styling/@type='date'] |

fi:field[not(fi:styling/@type)][fi:datatype[@type='date'][fi:convertor/@vari
ant='date']][not(fi:selection-list)] |

fi:aggregatefield[not(fi:styling/@type)][fi:datatype[@type='date'][fi:conver
tor/@variant='date']][not(fi:selection-list)]" priority="100">
    <xsl:variable name="id" select="generate-id()"/>

    <xsl:variable name="format">
      <xsl:choose>
        <xsl:when test="fi:datatype[@type='date']/fi:convertor/@pattern">
          <xsl:value-of
select="fi:datatype[@type='date']/fi:convertor/@pattern"/>
        </xsl:when>
        <xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- regular input -->
    <input id="{@id}" name="{@id}" value="{fi:value}"
title="{normalize-space(fi:hint)}" type="text">
      <xsl:apply-templates select="." mode="styling"/>
    </input>

    <!-- calendar popup -->
    <xsl:choose>
      <xsl:when test="@state = 'disabled'">
        <!-- TODO: i18n key for @alt -->
        <img src="images/cal.gif" style="border:0" alt="Calendar"/>
      </xsl:when>
      <xsl:otherwise>
        <a name="{@id}" id="{@id}" href="javascript:displayCalendar('{@id}',
0, 0)"> <!-- TODO: i18n key for @alt -->
          <img src="images/cal.gif" style="border:0" alt="Calendar"/>
        </a>
      </xsl:otherwise>
    </xsl:choose>

    <!-- common stuff -->
    <xsl:apply-templates select="." mode="common"/>
  </xsl:template>



-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of matra
Sent: Friday, 5 May 2006 6:20 AM
To: users@cocoon.apache.org
Subject: cforms: wizard lookup (popup)


Hi,

In a cocoon form, how is it possible to mimic the functionality of date
fields/calendar-popups

i.e. have an img next to a field, when clicked, a new window will popup
containing some kind of a wizard (possibly another cocoon app). Uppon
submission (of the wizard) the calculated value should be sent back to the
field

for example, lets say that we have a zip-code field. and we like to offer
a popup wizard where the user will enter the street address
(in text or in an imagemap) and we will come up with the proper zip-code

TIA
-km





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



--
Disclaimer: This email is confidential and may contain privileged information for the sole use of the person or business to which it is addressed. If you are not the intended recipient, please notify the sender by return e-mail or phone as you must not view, disseminate, distribute or copy this email without our consent. We do not accept any liability in connection with any computer virus, data corruption, incompleteness, or unauthorised amendment of this email. It is the sole responsibility of the receiver to scan for viruses before opening.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org