You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Cyrille (JIRA)" <de...@tapestry.apache.org> on 2007/07/23 15:59:31 UTC

[jira] Created: (TAPESTRY-1663) @RadioGroup client-side validation does not work

@RadioGroup client-side validation does not work
------------------------------------------------

                 Key: TAPESTRY-1663
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
             Project: Tapestry
          Issue Type: Bug
          Components: JavaScript
    Affects Versions: 4.1.2
         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
            Reporter: Cyrille


The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.

The Template part :

<div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
 choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
 choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
</div>

The generated html :

...
<div>
 choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
</div>
...
<script type="text/javascript"><!--
dojo.addOnLoad(function(e) {
dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
tapestry.form.focusField('text01');
tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
// --></script></body>
</html>

I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.

I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.

Ask me for more detail if needed.
Cheers
Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by "Robert Binna (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542416 ] 

Robert Binna commented on TAPESTRY-1663:
----------------------------------------

The fix introduced by Jesse Kuhnert on 28/Jul/07 on file src/js/dojo-0.4.3/src/validate/check.js unfortunately breaks validation for comboboxes (e.g. validators="validators:required" in PropertySelection).

In the case of (_b.type=="select-one") && (_b.selectedIndex!=-1) the else-branch is entered and dojo.lang.isArrayLike(_b) is true; but _b does not have any member with a property .checked, because it is a select-box and its elements are options containing the property .selected;

Suggested fix:
Replace 
if(!dj_undef("type",_b)&&(_b.type=="select-one"||_b.type=="select-multiple")&&(_b.selectedIndex==-1||/^\s*$/.test(_b.options[_b.selectedIndex].value))){
_3[_3.length]=_b.name;
}else{
if(dojo.lang.isArrayLike(_b)){
...
}

by
if(!dj_undef("type",_b)&&(_b.type=="select-one"||_b.type=="select-multiple")) {
  if(_b.selectedIndex==-1||/^\s*$/.test(_b.options[_b.selectedIndex].value))){
    _3[_3.length]=_b.name;
  }
}else{
if(dojo.lang.isArrayLike(_b)){
var _d=false;
for(var j=0;j<_b.length;j++){
if(_b[j].checked){
_d=true;
}

In that way, validation for select-one and select-multiple will be ok, if there is a selectedIndex, and the else-branch (which is only meant for the radio buttons...) is never entered.



> @RadioGroup client-side validation does not work
> ------------------------------------------------
>
>                 Key: TAPESTRY-1663
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 4.1.2
>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>            Reporter: Cyrille
>            Assignee: Marcus Schulte
>             Fix For: 4.1.3, 4.1.4
>
>
> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
> The Template part :
> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
> </div>
> The generated html :
> ...
> <div>
>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
> </div>
> ...
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
> tapestry.form.focusField('text01');
> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
> // --></script></body>
> </html>
> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
> Ask me for more detail if needed.
> Cheers
> Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by "Marcus Schulte (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514768 ] 

Marcus Schulte commented on TAPESTRY-1663:
------------------------------------------

This is a bug in dojo.
Dojo assumed myForm['radioGroupName'] to be an instance of Array if more than one input element
of that name exist. This is not the case, however.

It could be fixed by changing/overriding dojo.validate.check to test
for a length-property in the following way:
...
// Does radio button group (or check box group) have option checked.
			else if(elem.length > 1){    // erroneous check was: elem instanceof Array
				var checked = false;
				for(var j = 0; j < elem.length; j++){
					if (elem[j].checked) { checked = true; }
				}
				if(!checked){	
					missing[missing.length] = elem[0].name;
				}
			}
...

I'm not sure, whether we'll get this fixed in an official dojo 0.4 releas or whether we should just patch the thing in Tapestry by overriding the rather lengthy function in form.js or so.

> @RadioGroup client-side validation does not work
> ------------------------------------------------
>
>                 Key: TAPESTRY-1663
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 4.1.2
>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>            Reporter: Cyrille
>
> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
> The Template part :
> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
> </div>
> The generated html :
> ...
> <div>
>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
> </div>
> ...
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
> tapestry.form.focusField('text01');
> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
> // --></script></body>
> </html>
> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
> Ask me for more detail if needed.
> Cheers
> Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by "Marcus Schulte (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcus Schulte resolved TAPESTRY-1663.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.1.4

> @RadioGroup client-side validation does not work
> ------------------------------------------------
>
>                 Key: TAPESTRY-1663
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 4.1.2
>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>            Reporter: Cyrille
>            Assignee: Marcus Schulte
>             Fix For: 4.1.4, 4.1.3
>
>
> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
> The Template part :
> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
> </div>
> The generated html :
> ...
> <div>
>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
> </div>
> ...
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
> tapestry.form.focusField('text01');
> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
> // --></script></body>
> </html>
> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
> Ask me for more detail if needed.
> Cheers
> Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: [jira] Resolved: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by #Cyrille37# <cy...@gmail.com>.
Jesse Kuhnert (JIRA) a écrit :
>      [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Jesse Kuhnert resolved TAPESTRY-1663.
> -------------------------------------
>
>        Resolution: Fixed
>     Fix Version/s: 4.1.3
>          Assignee: Jesse Kuhnert
>
> Fixed in dojo - should work on radio groups now.  Not sure how you want to decorate a radio group on client side but I probably need to update that as well at some point.
>   
Thanks Jesse for your work. You're so fast ;-)

I'll make some tries some days, when I'll get the 4.2.3 version. For now 
I'm only using 4.1.2.

cheers
cyrille

>   
>> @RadioGroup client-side validation does not work
>> ------------------------------------------------
>>
>>                 Key: TAPESTRY-1663
>>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>>             Project: Tapestry
>>          Issue Type: Bug
>>          Components: JavaScript
>>    Affects Versions: 4.1.2
>>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>>            Reporter: Cyrille
>>            Assignee: Jesse Kuhnert
>>             Fix For: 4.1.3
>>
>>
>> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
>> The Template part :
>> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
>> </div>
>> The generated html :
>> ...
>> <div>
>>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
>> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
>> </div>
>> ...
>> <script type="text/javascript"><!--
>> dojo.addOnLoad(function(e) {
>> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
>> tapestry.form.focusField('text01');
>> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
>> // --></script></body>
>> </html>
>> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
>> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
>> Ask me for more detail if needed.
>> Cheers
>> Cyrille
>>     
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Resolved: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert resolved TAPESTRY-1663.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.1.3
         Assignee: Jesse Kuhnert

Fixed in dojo - should work on radio groups now.  Not sure how you want to decorate a radio group on client side but I probably need to update that as well at some point.  

> @RadioGroup client-side validation does not work
> ------------------------------------------------
>
>                 Key: TAPESTRY-1663
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 4.1.2
>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>            Reporter: Cyrille
>            Assignee: Jesse Kuhnert
>             Fix For: 4.1.3
>
>
> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
> The Template part :
> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
> </div>
> The generated html :
> ...
> <div>
>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
> </div>
> ...
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
> tapestry.form.focusField('text01');
> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
> // --></script></body>
> </html>
> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
> Ask me for more detail if needed.
> Cheers
> Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Reopened: (TAPESTRY-1663) @RadioGroup client-side validation does not work

Posted by "Marcus Schulte (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcus Schulte reopened TAPESTRY-1663:
--------------------------------------

      Assignee: Marcus Schulte  (was: Jesse Kuhnert)

broken by fix for TAPESTRY-1753

> @RadioGroup client-side validation does not work
> ------------------------------------------------
>
>                 Key: TAPESTRY-1663
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1663
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 4.1.2
>         Environment: Firefox 2.0.0.5 and InternetExplorer 7.0.5730
>            Reporter: Cyrille
>            Assignee: Marcus Schulte
>             Fix For: 4.1.3
>
>
> The @RadioGroup client-side validation does not work: nothing append at form submit. Notive that it works fine on server-side.
> The Template part :
> <div jwcid="radioGroup01@RadioGroup" selected="ognl:radioGroup01Selected" displayName="RadioGroup 01" validators="validators:required" >
>  choix 1<input type="text" jwcid="radio01@Radio" value="literal:R01" /> <br/>
>  choix 2<input type="radio" jwcid="radio02@Radio" value="literal:R02" />
> </div>
> The generated html :
> ...
> <div>
>  choix 1<input type="radio" name="radioGroup01" id="radioGroup010" value="0" /><br/> 
> choix 2<input type="radio" name="radioGroup01" id="radioGroup011" value="1" />
> </div>
> ...
> <script type="text/javascript"><!--
> dojo.addOnLoad(function(e) {
> dojo.require("tapestry.form");tapestry.form.registerForm("theForm");
> tapestry.form.focusField('text01');
> tapestry.form.clearProfiles('theForm'); tapestry.form.registerProfile('theForm',{"required":["text01","radioGroup01"],"text01":{"required":["Vous devez entrer une valeur pour Le Text 01."]},"radioGroup01":{"required":["Vous devez entrer une valeur pour RadioGroup 01."]}});});
> // --></script></body>
> </html>
> I had a try with a "required" @TextField on the same page, and the client-side works fine for the field, there is only the RadioGroup client-side validation which does not works.
> I think about that, but I a beginner, so it's juste a idea : the javascript validation probably works only with element id, but in case of radios in a radiogroup only the name attribute is the same for all radios.
> Ask me for more detail if needed.
> Cheers
> Cyrille

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org