checkbox within radiobutton in cq dialog - widget

How to implement checkbox within radio button in cq dialog? I have the following code in my cq dialog:
<<eyecatcher
jcr:primaryType="cq:Widget"
title="title"
name="title"
type="radio"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<yes jcr:primaryType="nt:unstructured"
text="yes"
value="yes" >
<items jcr:primaryType="cq:WidgetCollection">
<new jcr:primaryType="cq:Widget"
fieldLabel="new"
name="./new"
type="checkbox"
xtype="selection">
</new>
<offer jcr:primaryType="cq:Widget"
fieldLabel="Offer"
name="./offer"
type="checkbox"
xtype="selection">
</offer>
</items>
</yes>
<no jcr:primaryType="nt:unstructured"
text="no"
value="no"/>
</options>
</eyecatcher>
When I douple click on the dialog, I can see only the radio button. what did I do wrong?

Related

How to set defaultCommand in a p:confirmDialog

I use JSF PrimeFaces 6.1 version
I have confirmDialog for several commandButton looks like
<p:commandButton id="applyButton" icon="icon-interaction-upload-3"
styleClass="icon-button edit-panel-apply main-button"
rendered="#{Bean.editMode}"
onclick="setMainButtonYes(); $('[id$=hiddenApplyButton]').click(); return false;"
title="Apply"/>
<p:commandButton id="hiddenApplyButton"
actionListener="#{Bean.save}"
style="display: none"
onstart="saveScrollPosition();blockUi('blockUI')"
oncomplete="unblockUi('blockUI');setScrollPosition();">
<p:confirm header="Blablabla"
message="Apply"
icon="ui-icon-alert"/>
</p:commandButton>
<p:commandButton id="discardButton" icon="icon-interaction-remove-2"
styleClass="icon-button edit-panel-discard" rendered="#{Bean.editMode}"
title="Discard"
onclick="setMainButtonNo(); $('[id$=hiddenDiscardButton]').click(); return false;"/>
<p:commandButton id="hiddenDiscardButton"
actionListener="#{Bean.discardChanges}"
style="display: none"
onstart="saveScrollPosition();blockUi('blockUI')"
oncomplete="unblockUi('blockUI');setScrollPosition();">
<p:confirm header="Blablabla"
message="Discard"
icon="ui-icon-alert"/>
</p:commandButton>
<p:confirmDialog id="confirmationDialog" global="true" closeOnEscape="true">
<p:commandButton id="yes" value="Yes"
styleClass="ui-confirmdialog-yes edit-confim-yes yesButtonUpdate"
onstart="saveScrollPosition();" oncomplete="setScrollPosition();"
icon="ui-icon-check"/>
<p:commandButton id="no" value="No"
styleClass="ui-confirmdialog-no edit-confim-no noButtonUpdate main-button"
onstart="saveScrollPosition();" oncomplete="setScrollPosition();"
icon="ui-icon-close"/>
</p:confirmDialog>
For Apply button when the dialog opened pressing Enter works right and saves changes, but in second case for discard button i want the Enter button to close the dialog without discarding changes.
I tried to add defaultCommand tag but it doesnt work. How can i set Enter for "no" commandButton in second case?
P.S.
setMainButtonYes/No() function just add needed class to buttons to paint them.
Not a solution as you'd expect, but with the limitations of confirmDialog maybe the only option would be to change the order of the buttons so that the first button was the default command:
<p:confirmDialog id="confirmationDialog" global="true" closeOnEscape="true">
<p:commandButton id="no" value="No" />
<p:commandButton id="yes" value="Yes"/>
</p:confirmDialog>

how can i switch required element with selectOneRadio

i hava a register page and i need if i select item radio for example item one password required get true and if i select item two required get false
<p:selectOneRadio id="connection" value="#{UserBean.connection}" >
<f:selectItem itemValue="One" />
<f:selectItem itemValue="two" />
</p:selectOneRadio>
and i want something with this logic
<c:if test="#{UserBean.connection =='One'}" >
<p:password id="pwd" value="#{UserBean.pwd}" required="false" />
</c:if>
<c:if>
<p:password id="pwd" value="#{UserBean.pwd}" required="true" />
</c:if>
kind regards and thanks in advance :-)

set <input type="radio" value in JSF backing bean

I make use of JSF , now I need to change the style of the radio buton by using plain HTML5 tag . How can I use the html tag to replace this
<h:selectOneRadio id="selectedAnswer" value="#{testBean.userAnswer}" layout="pageDirection">
<f:ajax event="change" execute="selectedAnswer" render="#none" />
<f:selectItems value="#{testBean.question.answers}" var="selectedAnswer" itemLabel="#{selectedAnswer.answer}" itemValue="#{selectedAnswer.id}" />
</h:selectOneRadio>
with this:
<ui:repeat var="selectedAnswer" value="#{testBean.question.answers}">
<label for="#{selectedAnswer.id}">
<input type="radio" id="#{selectedAnswer.id}" name="a-radio" value="#{selectedAnswer.id}" >
</input>
<span>#{selectedAnswer.answer}</span>
</label>
</ui:repeat>
How Can I set the value in the backing bean, in JSF you do this <h:selectOneRadio value="#{testBean.userAnswer}". in HTML what do you do?

Struts2 html checkbox not pre-checked

<body>
<h3>Register for a prize by completing this form.</h3>
<s:form action="register">
<s:textfield name="personBean.firstName" label="First name" />
<s:textfield name="personBean.lastName" label="Last name" />
<s:textfield name="personBean.email" label ="Email"/>
<s:textfield name="personBean.age" label="Age" />
<input type="checkbox" checked="checked" />
<s:submit/>
</s:form>
<input type="checkbox" checked="checked" />
</body>
I have a jsp with above content. The checkbox within the form is not checked whereas the checkbox outside form is pre-checked. I am mixing up plain html checkbox and non-html elements within a Struts2 form.
Here you have malformed html by putting input tag like that in your form.
To resolve it,you can use s:checkbox
<s:checkbox name="checkMe" fieldValue="true" label="Check Me for testing" value="true"/>

Read only text box size increased size automatically

I have the two text box(Using JSJ).
I have given txt box size as 50. It is working fine. Based on logic I have make one of the text to readonly disabled = true or disable = disabled. The read only text width is increasing its size.
When I inspect through f12,the size are showing 50 only,In inspect mode when i remove the
disable = disabled,it is reducing to actual size
I checked by the sample.
<h:inputText value="test" type="text" size="50">
</h:inputText>
<br/><br/>
<h:inputText value="tes1t" type="text" size="50" disabled="true">
</h:inputText>
I have pass the param to form as below :
Param
<ui:param name="validationMessageOnTheSameLine" value="true" />
<ui:param name="rowWidth" value="650px" />
<ui:param name="helpTextPaddingLeft" value="130px" />
<ui:param name="showAsterik" value="false" />
<ui:param name="showAsterikForUsername" value="false" />
<ui:param name="inputTextSize" value="50" />
<h:panelGrid columns="2" style="width: #{rowWidth}" id="emailValidated"
columnClasses="#{columnClass1}, #{columnClass2}">
<h:outputLabel value="#{uit.emailAddress}:" for="email">
<h:outputLabel styleClass="asterik" value="*"
rendered="#{showAsterik}" />
</h:outputLabel>
<h:panelGrid columns="2" styleClass="tableNoPadding">
<h:inputText value="#{userBean.emailAddress}" id="email"
styleClass="ux-margin-right-1t" size="#{inputTextSize}"
required="true" disabled="#{disableEmailInput}"
requiredMessage="#{uitkem.valueRequired}"
validatorMessage="#{uitkem.emailValidator}">
<f:validator validatorId="emailValidator" />
</h:inputText>
<rich:message for="email" />
</h:panelGrid>
</h:panelGrid>
Check that these <h:inputText> are enclosed in <h:form>.
Also, you don't need to add type="text" in <h:inputText>.
From my test environment (JSF 2.2), both these inputs have the same size when rendered.