This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jul 27, 2011, 11:20 PM
6 Posts

Possible Required Field validation bug

  • Category: Forum design
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: validation,required field
  • Replies: 1
I'm having required field validation problem.  Say I have one button and two labels.  Whenever the button is click it toggles a viewScope variable
 
 viewScope.put("onoff", !viewScope.get("onoff"));
 
Label1 has render (hide/show) formula as
 
viewScope.get("onoff");
 
Label2 has the exact opposite
 
!viewScope.get("onoff"); 
 
So when you toggle the button Label1 and Label2 shows up one or the other.  Simple and that works fine.
 
Now add a text field and make it a required field.  Now the on/off button stops working.  But, if I put at least one character in the text field then the on/off button starts working.  Is it suppose be like this?  Or, what I'm doing wrong?
 

Jul 28, 2011, 8:20 AM
272 Posts
Re: Possible Required Field validation bug
Hi,
 
this is not a bug, it's a feature ;-)
 
Not rendered means that an element is not visible anymore. But the UIComponent can still be required internally (inside the JSF-Tree)
To work as desired, you have to compute the "required"-property:
 
<xp:inputText id="inputText1">
        <xp:this.rendered><![CDATA[#{javascript:viewScope.get("onoff");}]]></xp:this.rendered>
        <xp:this.required><![CDATA[#{javascript:!viewScope.get("onoff"); }]]></xp:this.required>
</xp:inputText>
 
Sven

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal