fb:serverfbml 块内的 javascript 验证
我正在尝试验证来自我嵌入的多好友选择器的输入,如下所示:
<fb:serverFbml>
<script type="text/fbml">
<form action="http://example.com/testSubmit.php" method="POST" onsubmit="return validate(this);">
<fb:multi-friend-input name="hidden"/>
<input type="submit" value="Submit"/>
</form>
</script>
</fb:serverFbml>
正如预期的那样,当在 iframe 内呈现时, onsubmit 函数会以我的 appid 开头。我假设我需要将我的 javascript 嵌入到 iframe 中的某个位置,以便我对 validate() 函数的定义也可以在我的 appid 前面加上。
然而,我并没有这样做的运气。我尝试过多种方式将其嵌入 js,但没有成功。
谢谢!
I am trying validate input from a multi-friend-selector that I have embedded like so:
<fb:serverFbml>
<script type="text/fbml">
<form action="http://example.com/testSubmit.php" method="POST" onsubmit="return validate(this);">
<fb:multi-friend-input name="hidden"/>
<input type="submit" value="Submit"/>
</form>
</script>
</fb:serverFbml>
As expected, when rendered inside the iframe, the onsubmit function is prepended with my appid. I am assuming that I will need to embed my javascript somewhere within the iframe, so that my definition of the validate() function can be prepended with my appid as well.
However, I have not had any luck doing so. I have tried embedding it the js a number of ways with no luck.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我了解,您有 FBML 画布应用程序。
在这种情况下,您不需要
fb:serverFbml
包装器。如果仍然不起作用,请尝试按照此处所述添加事件侦听器:As I understand you have FBML canvas application.
In this case you don't need
fb:serverFbml
wrapper. If it still doesn't work try adding event listeners as described here:由于我需要此页面在 Facebook 内部以及 Facebook 外部呈现,并且我希望具有灵活性,因此我相信对我来说最好的选择是仅使用 js graph api 和 jquery 自动完成小部件。看起来不需要很多额外的工作,并且会给我带来更多的控制权。
Since I need this page to render inside of fb as well as outside of fb and I would like flexibility, I believe that the best option for me will be to just use the js graph api and the jquery autocomplete widget. Does not seem like a lot of extra work, and will provide a lot more control on my end.