You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by tkojemile <tk...@gmail.com> on 2011/06/06 11:36:47 UTC

Dependence between checkbox & textbox

Hi,

I'm trying to create dependence between checkbox & textbox. If checkbox is
selected textbox should be required to fill. If not it can be empty.

I created xhtml like this:

<tr:inputText id="email"
labelAndAccessKey="#{msg['subscriber.package.email']}"
value="#{createBean.subscriber.email}"
contentStyle="width: 200px;" maximumLength=""
validator="#{Validator.validateEmail}"
required="#{createBean.mobileAccessWeb}"
renderer="#{createBean.isMobileAccessWeb}"
partialTriggers="mobileAccessWeb">
<tr:selectBooleanCheckbox
labelAndAccessKey="#{msg['msg.webAccess']}:"
id="mobileAccessWeb" immediate="true" autoSubmit="true"
valueChangeListener="#{createBean.onChangeMobileAccessWeb}"
value="#{createBean.mobileAccessWeb}" />

But if I dont use checkbox (it is false) after loading and click save - it
is possible. If I select checkbox and enter data in email field and click
save - it is possible. If I select checkbox and deselect it - I got message:
E-Mail - You must enter a value.

Tried on google, but with no success.

Thanks for answer!

Regards, Mile
-- 
View this message in context: http://old.nabble.com/Dependence-between-checkbox---textbox-tp31781810p31781810.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.