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

I have a textbox that, onblur, needs to use ajax to call an action
with its value as a parameter.

now ideally this would be accomplished with

onblue="<?php echo $ajax->remoteFunction(array('url'=>array
('controller'=>'ratings','action'=>'rateItem',VALUE_GOES_HERE))); ?>"

I've tried replacing VALUE_GOES_HERE with 'this.value', this.value,
$javascript->codeBlock('this.value') and none of them work properly.

It seems like there would be a way to do this with cake.  I've
currently solved the problem with a work around by taking the
javascript code generated by cake and copying and pasting it in place
of the $ajax->remoteFunction code.  This way I can use this.value.

The result looks like this:

onblur = "new Ajax.Request('/charity/ratings/rateItem/' + this.value,
{asynchronous:true, evalScripts:true})"

This works... but I don't like breaking cake convention and it seems
as though there should be a "correct" way of doing this.

Does anybody know if there is?

Thanks in advance!

Dave


    回覆    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
Marcelo Andrade  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 11月7日, 下午11時09分
寄件人: Marcelo Andrade <mfandr...@gmail.com>
日期: Sat, 7 Nov 2009 12:09:02 -0300
當地時間: 2009年11月7日(星期六) 下午11時09分
主旨: Re: using javascript within $ajax->remoteFunction

With the corresponding view to the remote function
call set a variable in a hidden field.  And then, in the
"oncomplete" attribute, use something like
Form.Element.setValue('YourField', $F('HiddenField'));

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105


    回覆    回覆作者    轉寄  
您必須先登入才能張貼訊息。
若要張貼訊息,您必須先加入此群組
請在留言之前更新您訂閱設定網頁上的暱稱。
您沒有留言所需的權限。
David Roda  
檢視個人資料   翻譯為 已翻譯 (查看原文)
 更多選項 11月8日, 上午3時58分
寄件人: David Roda <davidcr...@gmail.com>
日期: Sat, 7 Nov 2009 14:58:53 -0500
當地時間: 2009年11月8日(星期日) 上午3時58分
主旨: Re: using javascript within $ajax->remoteFunction

I'm sorry I think you misunderstood my question

I am trying to figure out how to pass a javascript value from the page which
calls the ajax function.

I was able to do this by copying and pasting the javascript generated by the
CakePHP Ajax helper and modifying it, but I am looking for a way to do this
within the framework because from what I gather pretty much anything you
need to do you can do with the CakePHP built in methods.

On Sat, Nov 7, 2009 at 10:09 AM, Marcelo Andrade <mfandr...@gmail.com>wrote:


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

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