$.validator.addMethod(
"regexName",
function(value, element) {
var check = false;
var re = new RegExp('^[a-zA-Z _0-9.]+$');
return this.optional(element) || re.test(value);
},
"No special characters allowed!"
);
rules: {
LoginName: {
required: true,
regexName:true
},
Friday, February 26, 2010
Open fancybox on Input Click
1)
$(document).ready(function()
{
$("#BTN").click(function()
{
$('test desc').fancybox().click();
});
});
2)
$("#buttontoclick").click(function() {
$('Friendly description').fancybox({
overlayShow: true
}).click();
});
3)
function OpenPage(id) {
$('dummy_anchor').fancybox({
'frameWidth': 420, 'frameHeight': 413 // 'frameHeight': 232
}).click();
}
$(document).ready(function()
{
$("#BTN").click(function()
{
$('test desc').fancybox().click();
});
});
2)
$("#buttontoclick").click(function() {
$('Friendly description').fancybox({
overlayShow: true
}).click();
});
3)
function OpenPage(id) {
$('dummy_anchor').fancybox({
'frameWidth': 420, 'frameHeight': 413 // 'frameHeight': 232
}).click();
}
JS file with Server Side Variable
Javascript object and class concept
<_script_start>
var path = {
currentUrl: "",
getPath: function() {
return this.currentUrl;
},
TEST: function() {
alert(this.currentUrl);
}
}
script type="text/javascript">
path.currentUrl = '';
path.TEST();
<_script_start>
var path = {
currentUrl: "",
getPath: function() {
return this.currentUrl;
},
TEST: function() {
alert(this.currentUrl);
}
}
script type="text/javascript">
path.currentUrl = '';
path.TEST();
authorized.net complete
after including previous four classes call this function on button click
private void DoPayment()
{
AuthorizeNetRequest objAuthorizeNetRequest = new AuthorizeNetRequest();
// This is the account information for merchant account given by Authorize.Net people in email
// I can see transaction history here.
objAuthorizeNetRequest.Login = LOGINID;
objAuthorizeNetRequest.Amount = Convert.ToDouble(txtAmount.Text);
objAuthorizeNetRequest.CardNumber = txtCreditCardNo.Text;
objAuthorizeNetRequest.CardExpirationDate = drpExpirationDate.SelectedValue + drpYear.SelectedValue.Substring(2);
objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.AUTH_CAPTURE;
///transaction types
///default is auth capture
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.AUTH_ONLY;
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.CREDIT;
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.VOID;
///we can use other types but will have to provide transaction id if we are going to
///PRIOR_AUTH_CAPTURE type as this will capture prior authorized transaction.
//objAuthorizeNetRequest.TransactionId = "";
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.PRIOR_AUTH_CAPTURE;
objAuthorizeNetRequest.CcvNumber = txtCCV.Text;
// Below is the API created by me by registering for test account.
objAuthorizeNetRequest.TransactionKey = TRANSACTION_KEY;
AuthorizeNetFields allFields = new AuthorizeNetFields();
allFields.x_First_Name = txtCardName.Text;
allFields.x_Address = "";
allFields.x_City = "";
allFields.x_State = "";
allFields.x_Country = "U.S.A";
allFields.x_Phone = "";
allFields.x_Zip = "";
allFields.x_Tax = "";
allFields.x_Email = "";
allFields.x_Description = "";
allFields.x_Ship_to_first_name = txtCardName.Text;
allFields.x_Ship_to_address = "";
allFields.x_Ship_to_city = "";
allFields.x_Ship_to_state = "";
allFields.x_Ship_to_country = "U.S.A";
allFields.x_Ship_to_phone = "";
allFields.x_Ship_to_zip = "";
AuthorizeNetResponse objAuthorizeNetResponse = AuthorizeNet.CallAuthorizeNetMethod(objAuthorizeNetRequest, allFields);
if (objAuthorizeNetResponse.IsSuccess)
{
Response.Write(objAuthorizeNetResponse.SuccessMessage +" ID:"+ objAuthorizeNetResponse.TransactionId);
}
else
{
Response.Write("Error : " + objAuthorizeNetResponse.Errors);
}
}
private void DoPayment()
{
AuthorizeNetRequest objAuthorizeNetRequest = new AuthorizeNetRequest();
// This is the account information for merchant account given by Authorize.Net people in email
// I can see transaction history here.
objAuthorizeNetRequest.Login = LOGINID;
objAuthorizeNetRequest.Amount = Convert.ToDouble(txtAmount.Text);
objAuthorizeNetRequest.CardNumber = txtCreditCardNo.Text;
objAuthorizeNetRequest.CardExpirationDate = drpExpirationDate.SelectedValue + drpYear.SelectedValue.Substring(2);
objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.AUTH_CAPTURE;
///transaction types
///default is auth capture
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.AUTH_ONLY;
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.CREDIT;
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.VOID;
///we can use other types but will have to provide transaction id if we are going to
///PRIOR_AUTH_CAPTURE type as this will capture prior authorized transaction.
//objAuthorizeNetRequest.TransactionId = "";
//objAuthorizeNetRequest.TransactionType = AuthorizeNet.TransactionType.PRIOR_AUTH_CAPTURE;
objAuthorizeNetRequest.CcvNumber = txtCCV.Text;
// Below is the API created by me by registering for test account.
objAuthorizeNetRequest.TransactionKey = TRANSACTION_KEY;
AuthorizeNetFields allFields = new AuthorizeNetFields();
allFields.x_First_Name = txtCardName.Text;
allFields.x_Address = "";
allFields.x_City = "";
allFields.x_State = "";
allFields.x_Country = "U.S.A";
allFields.x_Phone = "";
allFields.x_Zip = "";
allFields.x_Tax = "";
allFields.x_Email = "";
allFields.x_Description = "";
allFields.x_Ship_to_first_name = txtCardName.Text;
allFields.x_Ship_to_address = "";
allFields.x_Ship_to_city = "";
allFields.x_Ship_to_state = "";
allFields.x_Ship_to_country = "U.S.A";
allFields.x_Ship_to_phone = "";
allFields.x_Ship_to_zip = "";
AuthorizeNetResponse objAuthorizeNetResponse = AuthorizeNet.CallAuthorizeNetMethod(objAuthorizeNetRequest, allFields);
if (objAuthorizeNetResponse.IsSuccess)
{
Response.Write(objAuthorizeNetResponse.SuccessMessage +" ID:"+ objAuthorizeNetResponse.TransactionId);
}
else
{
Response.Write("Error : " + objAuthorizeNetResponse.Errors);
}
}
part-4 AuthorizeNetResponse.cs
AuthorizeNet.cs
AuthorizeNetFields.cs
AuthorizeNetRequest.cs
AuthorizeNetResponse.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
///
/// Summary description for AuthorizeNetResponse
///
public class AuthorizeNetResponse
{
public AuthorizeNetResponse()
{
//
// TODO: Add constructor logic here
//
}
private string mstrTransactionId;
private string mlstErrors;
private string mlstSuccessMessage;
public string SuccessMessage
{
get { return mlstSuccessMessage; }
set { mlstSuccessMessage = value; }
}
private bool mblnIsSuccess;
public bool IsSuccess
{
get { return mblnIsSuccess; }
set { mblnIsSuccess = value; }
}
public string Errors
{
get { return mlstErrors; }
set { mlstErrors = value; }
}
public string TransactionId
{
get { return mstrTransactionId; }
set { mstrTransactionId = value; }
}
}
AuthorizeNetFields.cs
AuthorizeNetRequest.cs
AuthorizeNetResponse.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
///
/// Summary description for AuthorizeNetResponse
///
public class AuthorizeNetResponse
{
public AuthorizeNetResponse()
{
//
// TODO: Add constructor logic here
//
}
private string mstrTransactionId;
private string mlstErrors;
private string mlstSuccessMessage;
public string SuccessMessage
{
get { return mlstSuccessMessage; }
set { mlstSuccessMessage = value; }
}
private bool mblnIsSuccess;
public bool IsSuccess
{
get { return mblnIsSuccess; }
set { mblnIsSuccess = value; }
}
public string Errors
{
get { return mlstErrors; }
set { mlstErrors = value; }
}
public string TransactionId
{
get { return mstrTransactionId; }
set { mstrTransactionId = value; }
}
}
Subscribe to:
Posts (Atom)