When implementing a Facebook Canvas app using an iframe the iframe does a post to my page. This is fine, but it causes the validators to fire which brings up the page with errors on all of the input fields.
Is there anyway to not have the validators fire on this initial page load through the iframe canvas?
Here is a sample code snippet:
@model My.User
@using (Html.BeginForm())
{
@Html.TextBoxFor(e => e.FirstName)
@Html.ValidationMessageFor(e => e.FirstName)
<input type="submit" />
}
In the interest of using the framework and not making a hack, this is how I solved this… I am not set that this in the end all be all because there are some issues when implementing this with larger sets of permissions which are noted below. The main issue is the constraint of the length of the URL.
First, when the user hits the site I am deciding to send them along based on my own set of rules, but still persist the signed request from Facebook via the URL.
Now the issue with this is that you will run out of space to store the signed request as a query string variable if you have been allowed more information about the FB user (i.e. Likes, Friends, etc.). You could capture the signed request and store it before the redirect and then give the user a token in a cookie to pass along to access the data throughout the rest of the session.