2016-11-14 105 views
1

我搜索了顯示的驗證消息,但無法在整個項目中找到它們。本地化asp.net webforms驗證消息

例如,當我輸入一些值,而@符號爲<input type="email" />我得到驗證錯誤:

please include an @ in the email address

但我無法找到任何地方此消息。

我試圖翻譯和本地化這些消息。

+0

http://stackoverflow.com/questions/13798313/set-custom-html5-required-field-validation-message我們走吧! – mybirthname

回答

0

這是一個默認的HTML輸入驗證消息。 當我們使用需要在HTML表單輸入標籤的結束,它給我們特定的輸入類型的具體驗證消息.. 例如

<input type="text" name="usrname" required>

在這種情況下,它會把這個消息

please fill out this field

爲你的情況

<input type="email" name="usrname" required>
在這種情況下 提交它會給這個確認消息

please include an '@' in the email address

這裏所要求的屬性的形式是一個布爾屬性。如果存在,它指定用戶在提交表單之前需要選擇一個值。

+0

我想要做的是將消息翻譯成另一種語言。不要更改驗證類型。 –

+0

在這種情況下,應該使用JavaScript來做到這一點.. 例如 ​​<跨度ID = 'errorFname' 類= 'SPN'> –

+0

在此情況下,你應該使用JavaScript來做到這一點。例如在HTML標籤 ' ' 就這樣,聲明ID輸入標籤和span標籤, 和腳本標籤,你應該調用自定義驗證消息的ID和設置值.. **名不能爲空* * –