让HTML5在多个聚合物飞镖组件的窗体中工作 [英] Getting HTML5 to work in Form with multiple polymer-dart components

查看:98
本文介绍了让HTML5在多个聚合物飞镖组件的窗体中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读Seth Ladd的博客 http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html

I was reading Seth Ladd's blog at http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html

Lets例如我添加另一个Form组件(Form2)重复步骤3和4,然后在步骤5中导入Form2。所以步骤5应该看起来像下面的代码:

Lets say I add another Form component (Form2) repeating Steps 3 and 4, and then import Form2 in Step 5. So Step 5 should look like the code below:

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    <title>Sample app</title>
    <link rel="stylesheet" href="parse_form_submit.css">
    <link rel="import" href="person_form.html">
    <script src="packages/polymer/boot.js"></script>
 </head>
 <body>
   <h1>Forms</h1>

<!-- Due to a bug in polymer, we can't use custom attributes.
     See https://code.google.com/p/dart/issues/detail?id=12262
     <person-form action="http://localhost:8888/submit"></person-form>
-->

<!-- in the meantime -->
    <person-form></person-form>
    <form-2><form-2>

  </body>
</html>

现在我应该将提交按钮放在其中一个表单中哪些表格是进口的?在任何一种情况下,我如何获得自动验证等htnl5点击提交按钮?一切都适用于一个单一的表单,其中包含自己的提交按钮在标记内,但不是那样当提交按钮放置在标记外部。

Where should I now put the 'Submit' button - in one of the forms or in the parent into which the forms are imported? In either case, how do I get auto-validation etc by htnl5 when the submit button is clicked? Everything works fine for a single form that contains its own submit button within the tag, but not so when the submit button is placed external to the tag.

感谢

推荐答案

假设 person-form form-2 是封装的表单,每个都有自己的提交按钮。

Assuming both person-form and form-2 are encapsulated forms, each will have their own submit button.

我不认为一个< form& 标签将进入Shadow DOM以查找自定义元素内的字段。所以最好的想法是:

I don't think a <form> tag will see into the Shadow DOM to find fields inside of a custom element. So best to think of it like:

my-special-form extends form

也就是说,创建一个自定义元素,它本身就是一个完全封装的形式。

That is, create a custom element that is itself a fully encapsulated form.

这篇关于让HTML5在多个聚合物飞镖组件的窗体中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆