myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Madhav Bhargava" <Madhav_Bharg...@infosys.com>
Subject RE: client side validations
Date Tue, 07 Nov 2006 12:23:06 GMT
Abhilash,

 

I am not using facelets.

I removed the client side validator code and as expected the subForm was
working perfectly. However on the page:
http://myfaces.apache.org/sandbox/subForm.html there is no where
documented that subForm will not work for client side validations. 

One reason can be that there are no standard client side validators
which are a part of myfaces component library.

 

Both client side validator component and the subForm component work
properly independently. Is there any other solution to this problem of
partial form validations at the client side?

 

Thanks,

~madhav

 

________________________________

From: Kumar, Abhilash (Gok) [mailto:abhilash-gok.kumar@hp.com] 
Sent: Tuesday, November 07, 2006 5:43 PM
To: MyFaces Discussion
Subject: RE: client side validations

 

Can u pls try to narrow down the problem ? In the sense, try to figure
out which module (sandbox or jsf-comp) is not behaving properly. Just
change the validation to normal jsf required validation and see whether
sandbox is working properly.

 

-- Kannan.

 

________________________________

From: Madhav Bhargava [mailto:Madhav_Bhargava@infosys.com] 
Sent: Tuesday, November 07, 2006 5:09 PM
To: MyFaces Discussion
Subject: RE: client side validations

I tried using the following combination:

Client validators defined in
http://jsf-comp.sourceforge.net/components/clientvalidators/index.html
+ sandbox subForm component to do partial client side validations.

 

It did not work!!! 

 

Code snippet:

 

<s:subForm id="demogrphicMain">

          <t:inputText id="txtLastName" forceId="true"
value="#{addUserWizardBean.wizard.demographicCaptureState.lastName}">

     </t:inputText>

     <cv:requiredFieldValidator componentToValidate="txtLastName"
highlight="true" display="dynamic"/>

</s:subForm>

 

<s:subForm id="addressSubForm">

<t:panelGroup>

           <t:outputText
value="#{msg['label.demographicdetails.address-1']}"

                 styleClass="outputLabelText"></t:outputText>

           <f:verbatim>

                 <font color="red">*&nbsp;</font>

           </f:verbatim>

     </t:panelGroup>

     <t:panelGroup>

           <t:inputText id="txtAddressLine1" forceId="true" size="60">

           </t:inputText>

           <cv:requiredFieldValidator
componentToValidate="txtAddressLine1" display="dyamic"
highlight="true"/>

     </t:panelGroup>

</s:subForm>

 

<t:panelGrid align="center" columns="1">

     <t:panelGroup>

           <t:commandButton

                 value="#{msg['button.demographicdetails.add-another']}"

                 action="#{addUserWizardBean.addAddress}"
actionFor="addressSubForm"></t:commandButton>

           <f:verbatim>&#160;&#160;</f:verbatim>

           <t:commandButton
value="#{msg['button.demographicdetails.reset']}"></t:commandButton>

     </t:panelGroup>

</t:panelGrid>

 

<t:panelGrid align="center" columns="1">

     <t:panelGroup>

           <t:commandButton
value="#{msg['button.demographicdetails.proceed']}"

           action="#{addUserWizardBean.proceed}" onclick="return
validate();" actionFor="demogrphicMain"></t:commandButton>

     </t:panelGroup>

</t:panelGrid>

 

I haven't worked with client side validation but the problem that you
mentioned can be solved using sandbox subForm or trinidad subform or by
using the OptionalValidator listed in the MyFaces Wiki. I have used
sandbox subForm to solve this problem with server side validation.

 

-- Kannan.

 

________________________________

From: Madhav Bhargava [mailto:Madhav_Bhargava@infosys.com] 
Sent: Tuesday, November 07, 2006 11:10 AM
To: MyFaces Discussion
Subject: client side validations

Hi All,

 

MyForm:

Mandatory fields on the form:
1. Last Name
2. First Name
3. Gender
4. email

There is a section on the page where the user needs to provide address
information. Mandatory fields in that section are: 
1. address type
2. address line 1
3. state
4. zip
5. city

Address section has the following buttons - "Add Address", "Reset"
"Delete"

Page level buttons are: "Proceed", "Cancel" 

When the user has entered all the information then the user will click
on the proceed button. However, the user can first enter the address
information and click "Add address" and then enter a list of other
addresses similary. The problem is that when the user clicks "Add
address" form is submitted and all the fields which are assigned a
validator are validated. So even if the "proceed" button is not clicked
fields like "last name", "first name" etc will be validated and will
therefore throw error messages on the screen. 

I want to partially validate a page based on which button is clicked.
How can you do that with the client side validators that you have
created.

 

Currently I am using struts client validator with Myfaces but this
framework does not solve the above mentioned problem.

 

Googling a bit I found the following:

 

1.	http://shale.apache.org/shale-validator/index.html 
2.
http://jsf-comp.sourceforge.net/components/clientvalidators/index.html 

 

I am wondering will any one them solve the problem that I am facing
above.

 

~madhav

 

**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
solely for the use of the addressee(s). If you are not the intended
recipient, please notify the sender by e-mail and delete the original
message. Further, you are not to copy, disclose, or distribute this
e-mail or its contents to any other person and any such actions are
unlawful. This e-mail may contain viruses. Infosys has taken every
reasonable precaution to minimize this risk, but is not liable for any
damage you may sustain as a result of any virus in this e-mail. You
should carry out your own virus checks before opening the e-mail or
attachment. Infosys reserves the right to monitor and review the content
of all messages sent to or from this e-mail address. Messages sent to or
from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

 


Mime
View raw message