2011-12-19 49 views
0

我在jsp頁面上有一個dojo編輯器。 dojo編輯器是必填字段之一,我有一個適當的驗證。有一種情況是一些標籤被追加。在追加時我找不到特定的模式,但在編輯器上選擇並複製所有內容和粘貼後發生的大部分時間。因此,在這種情況下,編輯內容爲將標籤添加到dojo編輯器內容

<div id="dijitEditorBody">content which user entered</div> 

問題:當用戶刪除其進入的標籤仍然存在並得到提交的所有內容。在這種情況下ATLEAST視覺編輯器有沒有內容,但該領域存在以下值:

<div id="dijitEditorBody"></div> 

<div id="dijitEditorBody"><br /></div> 

所以跳過驗證並顯示當數據從數據庫中檢索一個空的編輯器?

我很困惑爲什麼這些標籤被追加? Actual data entered

Editor Content

+0

我不知道我明白...爲什麼你粘貼HTML代碼到編輯器中? – Philippe 2011-12-19 18:07:00

+0

@Phillipe對於混淆,我很抱歉。我沒有在編輯器中粘貼html代碼。在這種情況下,「編輯器內容」正被複制並粘貼到編輯器中。這個內容沒有這個div標籤。但是在提交時我發現編輯器內容附加了一個div標籤。我不確定這個div標籤是從哪裏來的。 – SJ11 2011-12-19 18:34:45

+0

你用什麼版本的dojo? – Philippe 2011-12-19 18:42:29

回答

1

在RichText.js,這個片段:

if(dojo.isIE || dojo.isWebKit || (!this.height && !dojo.isMoz)){ 
     // In auto-expand mode, need a wrapper div for AlwaysShowToolbar plugin to correctly 
     // expand/contract the editor as the content changes. 
     html = "<div id='dijitEditorBody'></div>"; 
     setBodyId = false; 
    }else if(dojo.isMoz){ 
     // workaround bug where can't select then delete text (until user types something 
     // into the editor)... and/or issue where typing doesn't erase selected text 
     this._cursorToStart = true; 
     html = "&nbsp;"; 
    } 

解釋爲什麼添加了這個標籤的原因... 雖然你在alertbox看到它,我相信這不是存在於發佈的內容中...對嗎? 編輯應該照顧刪除額外的標籤=>未經測試,但非常確定...

+0

大多數情況下這個標籤不存在。但在這種特殊情況下,div標籤確實顯示在警報箱中並插入到數據庫中。 – SJ11 2011-12-19 20:06:35

+0

像這樣在黑暗中拍攝有點困難...如果你曾經設法重現這個問題,請發佈更多細節。如果你發佈你的代碼,Maybie會有一些幫助。 – Philippe 2011-12-19 22:15:36

+0

當然。感謝您的投入和努力。 – SJ11 2011-12-20 20:21:34

相關問題