2013-11-21 17 views
1

我正在讀塞特拉德的博客在http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html獲取HTML5到在具有多個聚合物鏢部件

形式工作可以說我添加重複步驟3和4的另一種形式的組分(窗體2),然後導入窗體2在第5步所以第5步應該看起來像下面的代碼:

<!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獲得自動驗證等?對於在標籤中包含自己的提交按鈕的單一表單,一切工作正常,但當提交按鈕放置在標籤外部時,則不會如此。

感謝

回答

1

假設都person-formform-2封裝形式,每一個都會有自己的提交按鈕。

我不認爲<form>標記將會看到Shadow DOM來查找自定義元素內的字段。所以最好把它想:

my-special-form extends form

也就是說,創建本身就是一個完全封裝形式的自定義元素。