Vaadin:带有表单的自定义布局 [文本字段标题和所需指示符]
我们正在开发一些Form,但是在Vaadin Forms中使用CustomLayout。我们在 HTML 中使用了 Field 标签,并且想要隐藏 TextField 标题。还想在文本字段的左侧添加必填属性。
图形设计师和开发人员之间的任务是分离的,因此自定义布局对我们来说很方便,因此我们现在不能使用任何其他布局。
目前我的测试屏幕如下,[在表单中仅添加了两个字段以进行自定义布局] 正如您所看到的,“hello”标题位于文本框的顶部,我想将其完全删除。此标题仅用于说明目的,否则我将其设为空,但表格中仍然有空间。我还想让所需的指示器与文本框对齐。
我做了一个 Form Field 工厂并尝试了很多选择但没有成功。
如果需要任何特定的 CSS 更改,请清楚地告诉我如何添加它,因为我是 CSS 新手。根据之前对论坛的讨论,我在 TextField 中添加了以下样式,但没有成功,
myLabel.setStyleName("inline");
并使用 CSS:
.inline, .inline div { display: inline; }
[我的情况是我将其添加到 TextField 对象中}
We are developing some Form, but using CustomLayout in Vaadin Forms. we used Label of Field in HTML and want to suppress the TextField Caption. Also want to make required attribute in the left side of text field.
There is separation of tasks between graphics designer and developer, so Custom layout is convenient for us, so we cannot use any other layout right now.
Currently my test screen is as follows, [added only two fields in Form for custom layout]
As you can see that "hello" caption is top of Text Box, which I want to completely removed. This caption is just for illustration purpose, otherwise I make it empty, but still there is space in table. Also I want to make required indicator aligned with Text box.
I made a Form Field factory and tried many options but no luck.
if there is any specific CSS changes required please clearly tell me how to add it since I am new on CSS. based on previous discussion of Forum I added following style in my TextField without any sucess,
myLabel.setStyleName("inline");
and using CSS:
.inline, .inline div { display: inline; }
[my case I am adding it into TextField object }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“还想在文本字段的左侧设置必需的属性”如果你想让字段成为必需的,你应该为其设置属性 .setRequired(true);
如果您想手动处理表单中的所有元素位置,您应该执行以下操作:
"Also want to make required attribute in the left side of text field" if you want make field required you should set for it property .setRequired(true);
If you want handle all element position in your form manually you should do something like this: