You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Kröpfl <pe...@groebi.com> on 2005/05/10 12:54:49 UTC

cforms: mutliple booleanfields validation

Hi,

I have mutliple booleanfield widgets and want to make sure, that at least one of
them is checked. How would I do that?

I allready searched this newsgroup for similar questions, but i could not find
any. Looking at the samples I figured I could use <fd:javascript> and write my
own validation function in flow. However, I don't know how to access the widgets
in this function.

I hope somebody has allready done something like that and could help me.

Thanks, peter





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


Re: cforms: mutliple booleanfields validation

Posted by Lionel Crine <cr...@4dconcept.fr>.
Hi,

I have written some javascript to set dynamically some checkbox.

Here it is :

Lionel

------------------

<fd:booleanfield id="unverif">
      <fd:on-value-changed>
        <javascript>
         var value = event.source.value;
           var firstverWidget = event.source.lookupWidget("../firstver");
           var secverWidget = event.source.lookupWidget("../secver");
           if (value == "true") {
             firstverWidget.setValue(false);
             secverWidget.setValue(false);
           }
          </javascript>
      </fd:on-value-changed>
    </fd:booleanfield>
    <fd:booleanfield id="firstver">
      <fd:on-value-changed>
        <javascript>
          var value = event.source.value;
            var unverifWidget = event.source.lookupWidget("../unverif");
          var secverWidget = event.source.lookupWidget("../secver");
          var secverWidgetValue= secverWidget.value;
            if (value == "true") {
             unverifWidget.setValue(false);
              if (secverWidgetValue == "false") {
               secverWidget.setValue(false);
                }
        }
        if (value == "false") {
         secverWidget.setValue(false);
        }
<!--                     // Always set the type value to null. Note that 
it will also fire an event on the "type"
            // widget if it already had a value.-->
<!--            unverifWidget.setValue(null);
          firstverWidget.setValue(null);
            firstvertypeWidget.setValue(null);
            secverWidget.setValue(null);
             secvertypeWidget.setValue(null);-->
        </javascript>
      </fd:on-value-changed>
    </fd:booleanfield>
    <fd:booleanfield id="secver">
      <fd:on-value-changed>
        <javascript>
          var value = event.source.value;
            var unverifWidget = event.source.lookupWidget("../unverif");
          var firstverWidget = event.source.lookupWidget("../firstver");
          var firstverWidgetValue = firstverWidget.value;
            if (value == "true") {
             unverifWidget.setValue(false);
             firstverWidget.setValue(true);
        }
        if (value == "false") {
         if (firstverWidgetValue == "true"){
       
         }
        }
          <!--            // Always set the type value to null. Note 
that it will also fire an event on the "type"
            // widget if it already had a value.
            typewidget.setValue(null);-->
        </javascript>
      </fd:on-value-changed>
    </fd:booleanfield>

---------------------

Peter Kröpfl wrote:

>Hi,
>
>I have mutliple booleanfield widgets and want to make sure, that at least one of
>them is checked. How would I do that?
>
>I allready searched this newsgroup for similar questions, but i could not find
>any. Looking at the samples I figured I could use <fd:javascript> and write my
>own validation function in flow. However, I don't know how to access the widgets
>in this function.
>
>I hope somebody has allready done something like that and could help me.
>
>Thanks, peter
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>  
>

-- 
Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.46.06.90


CForms + i18n

Posted by Johannes Becker <jo...@gmx.net>.
Hi,

is there a tutorial or sample how to integrate i18n in a CForm? Couldn't 
find any information on this, except an old page 
http://www.ucc.ie:8080/cocoon/documents/howto/howto-i18n-xmlform.html

Can I just do something like this?: <fd:label><i18n:text 
key="password"/></fd:label>


Thanks
Jonny

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