所有網頁 圖片 影片 地圖 新聞 網誌搜尋 Gmail 更多 »
最近造訪的群組 | 說明 | 登入
Google 網上論壇首頁
Validate a single field
目前本群組有太多主題設為優先顯示。要優先顯示這個主題,請將其他主題的這個選項取消。
在處理您的要求時發生錯誤。請再試一次。
標幟
  3 個訊息 - 全部摺疊  -  將全文翻譯為 已翻譯 (查看所有原文)
您要留言的群組是 Usenet 群組。在此群組留言,網際網路上的任何使用者將可以看到您的電郵地址。
您的回覆郵件尚未寄出。
您已成功留言
 
寄件人:
收件人:
副本:
後續追蹤對象:
新增副本 | 新增後續追蹤對象 | 編輯主旨
主旨:
驗證:
為了確認,請輸入您在以下圖片中看到的字元,或輸入您按下存取圖示時所聽到的號碼。 注意聽並輸入您聽到的號碼
 
Dave  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 11月8日, 上午12時43分
寄件人: "Dave" <make.cake.b...@gmail.com>
日期: Sat, 7 Nov 2009 13:13:01 -0330
當地時間: 2009年11月8日(星期日) 上午12時43分
主旨: Validate a single field

How can I validate a single field using Ajax?

I am attempting to use jquery remote feature to check fields for validity.
But its checking the entire model and reporting fields that have not had
data entered. If a form has 3 fields and the user types into the second
field for example i only want to check if that field is valid, not the
entire form.

I am trying to validate an email to start off with so data[Profile][email] =
mytestem...@something.com gets sent to cake to validate

How can I validate only Profile.email? I want to use the same function
eventually to validate other fields so i do not want to hard code 'email'
into the function. Is there a way to get the field name [email] as a
variable and then validate just that rule in the model and return a true or
false?

Thanks

Dave


    回覆    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
euromark (munich)  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 11月8日, 上午1時25分
寄件人: "euromark (munich)" <dereurom...@googlemail.com>
日期: Sat, 7 Nov 2009 09:25:51 -0800 (PST)
當地時間: 2009年11月8日(星期日) 上午1時25分
主旨: Re: Validate a single field
just submit only that field

the model validation is only triggered for fields that are beeing
passed
so if there is only one passed form field, only this one will be
validated

PS: dont use "required''=>true" in your rules or you screw it up

On 7 Nov., 17:43, "Dave" <make.cake.b...@gmail.com> wrote:


    回覆    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Dave  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 11月8日, 上午2時01分
寄件人: "Dave" <make.cake.b...@gmail.com>
日期: Sat, 7 Nov 2009 14:31:55 -0330
當地時間: 2009年11月8日(星期日) 上午2時01分
主旨: RE: Validate a single field
I am getting closer but still no message shows up in the form.

I get the error div appearing but no message.
The response sent to the page looks like:

FIREFOX JSON TAB:

{"valid":false,"data[Profile][email]":{"messages":{"remote":"from cake"}}}

I will worry about the actual cake error message later so I just hard coded
"from cake" to see if it shows up but I get no message ever. If its valid
the error div still shows up.

I modified my validate options so they now look like:

var validate_options = {
        rules: {

                        "data[Profile][email]":{remote: {url:
"/manage/profiles/validate",type: "post", data: {fieldname: 'email'}}},

        },
        messages: {
                        }

};

Any ideas how why my messages: are not papering or why it error div appears
when valid?

Any help or suggestions would be great.

Thanks

Dave


    回覆    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
無其他留言
« 返回討論主題 « 較新的主題     較舊的主題 »

建立群組 - Google 網上論壇 - Google 首頁 - 服務條款 - 隱私權政策
©2009 Google