2014-10-10 127 views
1

我目前正在寫一張使用帶有X編輯和用戶界面,引導AngularJS代碼,我的問題是在這部分代碼:表單標籤被刪除

<div ng-repeat='task in CurrentOIDs | filter:criteria | orderBy:OrderField:ReverseSort'> 
    <div class='row {{!areCollapsed[task.OIDid] | selected}}' 
     style='background-color: {{ task.Status | color }};' 
     ng-click="checkCollapse(task.OIDid, !rowform.$visible);"> 
     <div style='width: 5%;' class='cell OIDid'> 
      {{ task.OIDid }} 
     </div> 
     <div style='width: 5%;' class='cell'> 
      <span buttons='no' onbeforesave='checkPriority($data)' 
        editable-select="task.Priority" 
        e-id='priorityInput' e-name="priority" 
        e-form='rowform' 
        e-ng-options="p.value as p.text for p in priorities"> 
       {{task.Priority}} 
      </span> 
     </div> 
     <div style='width: 13%;' class='cell'> 
      <span buttons='no' onbeforesave='checkTopic($data)' 
        editable-text='task.Topic' e-name='topic' 
        e-form='rowform' e-required e-list="Topics"> 
       {{ task.Topic }} 
      </span> 
     </div> 
     <div style='width: 20%;' class='cell'> 
      <span buttons='no' onbeforesave='checkCategory($data)' 
        editable-text='task.Category' e-id='categoryInput' 
        e-name='category' e-form='rowform' 
        e-required e-list="Categories"> 
       {{ task.Category }} 
      </span> 
     </div> 
     <div style='width: 35%;' class='cell'> 
      <span buttons='no' onbeforesave='checkTask($data)' 
        editable-text='task.Task' e-id='taskInput' 
        e-name='task' e-form='rowform' 
        e-required> 
       {{task.Task}} 
      </span> 
     </div>  
     <div style='width: 6%;' class='cell'> 
      {{ task.Added }} 
     </div> 
     <div style='width: 6%;' class='cell'> 
      {{ task.Target }} 
     </div> 
     <div style='width: 5%;' class='cell'> 
      <span buttons='no' onbeforesave='checkOwner($data)' 
        editable-text='task.Owner' e-name='owner' 
        e-form='rowform' e-required 
        e-list="Owners"> 
       {{ task.Owner }} 
      </span> 
     </div> 
     <div style='width: 5%;' class='cell Status'> 
      <span buttons='no' onbeforesave='checkStatus($data)' 
        editable-number='task.Status' e-min='0' 
        e-max='100' e-name='status' e-form='rowform' 
        e-required> 
       {{ task.Status }}% 
      </span> 
     </div> 
    </div> 
    <div collapse='areCollapsed[task.OIDid]'> 
     <div style='height: 30px;' ng-show='rowform.$visible'> 
      <form onbeforesave='saveTask($data, task.OIDid)' 
        editable-form name='rowform' 
        shown="inserted == task"> 
       <button type='submit' ng-disabled="rowform.$waiting" 
         id="saverowedit"> 
        OK 
       </button> 
       <button type="button" ng-disabled="rowform.$waiting" 
         ng-click="rowform.$cancel()" 
         id="cancelrowedit"> 
        CANCEL 
       </button> 
      </form>  
     </div> 
     <div style='height: 30px;' ng-show='!rowform.$visible'> 
      <button id='editButton' style='width: 25%;' title="Edit" 
        ng-click="rowform.$show()"> 
       <?php include("svg/edit.svg")?> 
      </button> 
      <button id='archiveButton' style='width: 25%;' title="Archive"> 
       <?php include("svg/archive.svg")?> 
      </button> 
      <button id='mailingButton' style='width: 25%;' title="MailingList"> 
       <?php include("svg/mail.svg")?> 
      </button> 
      <button id='historyButton' style='width: 25%;' title="History"> 
       <?php include("svg/history.svg") ?> 
      </button> 
     </div> 
    </div> 
</div> 

出於某種原因,當我檢查FORM標籤的結果代碼被完全刪除,只留下按鈕,但顯然如果它們不在表單標籤中,它們將不起任何作用。

我的問題是什麼可能導致這種情況發生?我該如何解決它?

感謝

+0

你有表格嗎? – epascarello 2014-10-10 19:29:43

+3

我已經將您的問題代碼格式化爲「可讀」,您無法想象它有多痛苦,所以請對代碼給予一些「關注」。 – 2014-10-10 19:59:41

+0

夠公平,道歉。據我所知不,我沒有嵌套形式。難道是因爲所有生成的表格都有相同的名字? – 2014-10-11 03:33:37

回答

0

HTML只允許一個<form>標籤,這樣的話你會看到

如果您使用的<ng-form>代替<form>它會允許你克服這一障礙。

https://docs.angularjs.org/api/ng/directive/ngForm

+0

歡呼聲的答案,但如果我記得正確(一段時間)我有一個失蹤的關閉窗體標記在我的代碼是搞砸了一切..仍然謝謝你的回答:) – 2017-02-15 20:54:50

+0

嗯,它發佈2年前,所以我很高興你想出了它:)我的問題花了很長時間才弄清楚,我非常沮喪,所以我想我會發布我的答案,至少讓我看到下一次我遇到它的答案:) – 2017-02-16 13:22:08