设置Facebook注册插件的默认值";“文本字段”;

设置Facebook注册插件的默认值";“文本字段”;,facebook,plugins,field,default,registration,Facebook,Plugins,Field,Default,Registration,下午好 我现在正在使用Facebook的注册插件,我想设置文本类型字段的默认值 但我不知道这是否可能?如何在PHP和插件中设置文本字段的默认值?谢谢你的帮助 <iframe src="https://www.facebook.com/plugins/registration? client_id=APP_ID& redirect_uri=[...]& fields=[{'name':'name'},

下午好

我现在正在使用Facebook的注册插件,我想设置文本类型字段的默认值

但我不知道这是否可能?如何在PHP和插件中设置文本字段的默认值?谢谢你的帮助

<iframe src="https://www.facebook.com/plugins/registration?
         client_id=APP_ID&
         redirect_uri=[...]&
         fields=[{'name':'name'},
                {'name':'last_name'},
                {'name':'first_name'},
                {'name':'birthday'},
                {'name':'gender'},
                {'name':'email'},
                {'name':'telephone', 'description':'T\u00e9l\u00e9phone', 'type':'text', 'default':'sith'},
                {'name':'portable', 'description':'Portable (facultatif)', 'type':'text','no_submit':true},
                {'name':'fax', 'description':'Fax (facultatif)', 'type':'text','no_submit':true},
                {'name':'adresse','description':'Adresse','type':'text','default':'truc'},
                {'name':'adresse_suite','description':'Adresse (suite)','type':'text','no_submit':true},
                {'name':'code_postal','description':'Code postal','type':'text'},
                {'name':'ville','description':'Ville','type':'text'},
                {'name':'pays','description':'Pays','type':'select',
                'options':[...]},
                {'name':'password'},
                {'name':'captcha'},
                {'name':'abonnement','description':'Re\u00e7evoir la Newsletter','type':'checkbox'},
                {'name':'stop_pub','description':'Re\u00e7evoir des offres marketing et bons d\'achat','type':'checkbox'},
                {'name':'offre_sortir','description':'Re\u00e7evoir des bons plans Sortir Malin dans votre r\u00e9gion','type':'checkbox'},
                {'name':'offre_partenaire','description':'Offres publicitaires de la part d\'autres partenaires','type':'checkbox'}]"
            scrolling="auto"
            frameborder="no"
            style="border:none"
            allowTransparency="true"
            width="100%"
            height="850"
            onvalidate="validate">
    </iframe>

对不起,我英语不好,我是法国人

根据,
默认值
参数仅适用于
类型:选择
类型:复选框
字段,而不适用于文本字段):因此您在这方面有点困难

供参考:

但是,如果是我,我会构建一个完整的选项数组,并一次性对它们进行编码,而不是直接在
标记中定义它们,例如:

<?php
$regOptions = array(
    array('name' => 'name'),
    array('name' => 'last_name'),
    array('name' => 'birthday'),
    //the other fields
    array('name' => 'telephone',
          'description' => 'T\u00e9l\u00e9phone',
          'type' => 'text'
    ),
    //the other fields  
);
?>

//Then in your iframe:
<iframe src="https://www.facebook.com/plugins/registration?
     client_id=APP_ID&
     redirect_uri=[...]&

     fields="<?= urlencode(json_encode($regOptiosn)); ?>

     scrolling="auto"
     frameborder="no"
     style="border:none"
     allowTransparency="true"
     width="100%"
     height="850"
     onvalidate="validate">
</iframe>

//然后在iframe中:

这个iframe代码有什么问题吗,或者你在问如何向它添加动态内容?我只是问如何通过PHP向它添加动态内容,并使其成为可选的(例如“fax”或“mobile phone”字段)。我遵循了你的第二个选择,但我总是遇到同样的问题。我无法为我的输入文本=(“default”属性不起作用。我在这里的代码:感谢您的回复,我找到了一个解决方案:将我的表单完成分为两个步骤:一个是基本信息、姓名、电子邮件…另一个是补充信息,如电话号码…再见!;)