2011-10-13 37 views
1

我在實施Facebook註冊工具時遇到問題。 我已經按照在Facebook上的文檔中描述的步驟,這裏是我的代碼:實施Facebook註冊工具 - 錯誤

 <iframe src="http://www.facebook.com/plugins/registration.php? 
      client_id=ID& 
      redirect_uri=redirect_url& 
      fields= [ 
{'name':'name'}, 
{'name':'email'}, 
{'name':'location'}, 
{'name':'gender'}, 
{'name':'birthday'}, 
{'name':'password', 'view':'not_prefilled'}, 
{'name':'like',  'description':'Do you like this plugin?', 'type':'checkbox', 'default':'checked'}, 
{'name':'phone',  'description':'Phone Number',    'type':'text'}, 
{'name':'anniversary','description':'Anniversary',    'type':'date'}, 
{'name':'captain', 'description':'Best Captain',    'type':'select', 'options':{'P':'Jean-Luc Picard','K':'James T. Kirk'}}, 
{'name':'force',  'description':'Which side?',    'type':'select', 'options':{'jedi':'Jedi','sith':'Sith'}, 'default':'sith'}, 
{'name':'live',  'description':'Best Place to Live',  'type':'typeahead', 'categories':['city','country','state_province']}, 
{'name':'captcha'} 
] 
" scrolling="auto" frameborder="no" style="border: none" allowtransparency="true" width="100%" 
      height="330"></iframe> 

我正與此錯誤消息面對:

未知的名稱:「[{」名「:」名'}'。從CSV切換到JSON以使用自定義字段,或檢查拼寫正確的字段。

任何幫助將非常感激

+0

Thnx :)。我會嘗試使用JSON對象 – MIlena

回答

2

我認爲,在這裏你的錯誤是iframe不能採取自定義字段(據我記得)。它看起來像從樣本中複製了代碼,並將其與該組字段合併。每當我做完這些事情,並且在他們的例子中,海關字段都與XFBML版本的頁面一起使用。例如,他們的代碼(用於演示您使用的字段)實際上是:

<fb:registration class=" fb_iframe_widget" redirect-uri="https://developers.facebook.com/tools/echo/" fields="[ {'name':'name'}, {'name':'email'}, {'name':'location'}, {'name':'gender'}, {'name':'birthday'}, {'name':'password'}, {'name':'like', 'description':'Do you like this plugin?', 'type':'checkbox', 'default':'checked'}, {'name':'phone', 'description':'Phone Number', 'type':'text'}, {'name':'anniversary','description':'Anniversary', 'type':'date'}, {'name':'captain', 'description':'Best Captain', 'type':'select', 'options':{'P':'Jean-Luc Picard','K':'James T. Kirk'}}, {'name':'force', 'description':'Which side?', 'type':'select', 'options':{'jedi':'Jedi','sith':'Sith'}, 'default':'sith'}, {'name':'live', 'description':'Best Place to Live', 'type':'typeahead', 'categories':['city','country','state_province']}, {'name':'captcha'} ]"> 

我認爲您的格式是正確的。嘗試使用XFBML插件,我認爲它會正常工作。

1

我刪除了字段參數中多餘的空白後,我設法讓它與iframe一起工作。不知道爲什麼。