html - jsf对齐panelgrid中的复选框

标签 html css jsf

你好,我有一个用 panelgrid 呈现的表单,其中有 3 列,如下所示:

Label-InputField-ErrorMessage

我想添加一些复选框,但对齐有问题。

    <h:panelGrid columns="3">
            <h:outputText value="Όνομα:"></h:outputText>
            <h:inputText id="name" value="#{regBean.name}" required="true"
                requiredMessage="Παρακαλώ εισάγετε όνομα!"
            >
                <f:validator validatorId="nameValidator" />
            </h:inputText>
            <h:message id="namemsg" for="name" style="color:red"></h:message>

            <h:outputText value="Επώνυμο:"></h:outputText>
            <h:inputText id="surname" value="#{regBean.surname}" required="true"
                requiredMessage="Παρακαλώ εισάγετε επώνυμο"
            >
                <f:validator validatorId="nameValidator" />
            </h:inputText>
            <h:message for="surname" style="color:red"></h:message>
<h:outputText value="Ενδιφέρομαι για"></h:outputText>
            <h:selectManyCheckbox>

                <f:selectItem itemValue="1" itemLabel="Number1 - 1" />
                <f:selectItem itemValue="2" itemLabel="Number1 - 2" />

                <f:selectItem itemValue="3" itemLabel="Number1 - 3" />
                <f:selectItem itemValue="4" itemLabel="Number1 - 4" />

            </h:selectManyCheckbox>

            <h:commandButton type="submit" value="Submit"></h:commandButton>
            <h:commandButton type="reset" value="Reset"></h:commandButton>
</h:panelGrid>

没有选择框: enter image description here

这是我添加它们时得到的: enter image description here

我想要这样的东西:

enter image description here

我尝试在 h:panelGrid 中添加 html 标签,但失败了。有什么方法可以只用css/html/jsf实现吗?

提前致谢

最佳答案

这比我想象的要容易。我必须添加 layout="pageDirection"<h:selectManyCheckbox>并将选择包装在 panelGroup

固定代码:

<h:outputText value="Ενδιαφέρομαι για"></h:outputText>
        <h:panelGroup layout="block">
            <h:selectManyCheckbox layout="pageDirection">
                <f:selectItem itemValue="1" itemLabel="Item 1" />
                <f:selectItem itemValue="2" itemLabel="Item 2" />
                <f:selectItem itemValue="3" itemLabel="Item 3" />
                <f:selectItem itemValue="4" itemLabel="Item 4" />
            </h:selectManyCheckbox>
        </h:panelGroup>

关于html - jsf对齐panelgrid中的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25248134/

相关文章:

html - parent 高度基于相对定位的 child

php - 为什么我必须使用 POST 而不是 GET?

html - DIV 神秘地被放置在其他 DIV 的后面?

javascript - 图像 src - 使用 meanjs 获取 404 错误

javascript - 我可以在内部 CSS 中使用 angular js 变量吗?

jsf - 没有指定值时,不应该跳过验证吗?

java - 如何向 JSF 添加两个属性文件

javascript - 迭代 DOM 和 JSON 响应的最佳实践

jsf - 'binding' 属性如何在 JSF 中工作?何时以及如何使用它?

html - HTML/CSS Hex 中的背景图像解决方法