using (Html.BeginForm("ExternalLogin", "Account",FormMethod.Post, new { ReturnUrl = ViewBag.ReturnUrl, id = "ExternalLoginForm" }))
{
@Html.AntiForgeryToken()
<fieldset id="socialLoginList">
<legend></legend>
@foreach (AuthenticationClientData p in Model)
{
<button style="width:100px;" type="submit" name="provider" class="btn_1" value="@p.AuthenticationClient.ProviderName" title="Log in using your @p.DisplayName account">@p.DisplayName</button>
}
</fieldset>
}
上記のフォームは、送信ボタン要素で正常に機能します。送信ボタンを以下に置き換えたい。
<a href="javascript:document.getElementById('ExternalLoginForm').submit()" class="btn btn-primary" id="provider">
<i class="icon-facebook"></i>
</a>
フォーム送信は上記のコードで正常に機能しますが、値はフォーム送信で渡されません。
例: 送信ボタンの投稿フォームには、@p.AuthenticationClient.ProviderName の値を持つ「Provider」パラメーターが含まれています。
このパラメーターを href 要素で渡すにはどうすればよいですか?