I have jquery code to validate.
function deneme() {
var url = document.getElementById('ctl00_PostitPanel_frmPostAc_txtLink').value;
var youtubeUrl = url.match(/watch\?v=([a-zA-Z0-9\-_]+)/);
var vimeoUrl = url.match(/^http:\/\/(www\.)?vimeo\.com\/(clip\:)?(\d+).*$/);
if (youtubeUrl) {
return true;
}
else if (vimeoUrl) {
return true;
}
else {
alert('Şimdilik Sadece Youtube ve Vimeo videolarını paylaşabilirsin.');
return false;
}
};
This codes working great.But I want to prevent insert event.It is showing alert.But then inserting item.And code behind.(My controls inside formview.It is not important.Because function working.)
Button btnKaydet = (Button)frmPostAc.FindControl("btnKaydet");
btnKaydet.Attributes.Add("onclick","deneme();");