where txtName is the id in the 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <3F1F006A.7010404@SatoriGroupInc.com> [ref] => [htmlstate] => on_nl2br [postusername] => Matthew Wieder [ip] => Development@Sat [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> > > where txtName is the id in the 1) The theForm.txtName.Value always gives undefined as the value instead > of the actual valus in the textbox. > 2) When the Javascript returns true, the page does not submit. > > Help anyone? > thanks! >[/quote] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <#l6uWNWUDHA.3916@tk2msftngp13.phx.gbl> [ref] => <3F1F006A.7010404@SatoriGroupInc.com> [htmlstate] => on_nl2br [postusername] => Vidar Petursson [ip] => theking@icysoft [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Client-Side Validation of asp:TextBox with Javascript - ASP.NET General

Client-Side Validation of asp:TextBox with Javascript - ASP.NET General

Hi - I'm trying to do client-side validation of the text in a Asp.Net textbox control using javascript. My page has the following: <form id="Form1" method="post" runat="server" onsubmit="return validateName(this);"> and <script language="JavaScript"><!-- function validateName(theForm) { var reEval = new RegExp("[\\/\:\*?\"\<\>|]", "i"); blnEval = reEval.test(theForm.txtName.Value) if (blnEval) { alert("A Valid name must not contain any of the characters \/:*?\"<>|"); return false; } else { return true; } } //--></script> where txtName is the id in the <asp:TextBox tag. Problem is 1) The theForm.txtName.Value always gives undefined as the value instead of the actual valus in the textbox. 2) When the Javascript ...

  1. #1

    Default Client-Side Validation of asp:TextBox with Javascript

    Hi - I'm trying to do client-side validation of the text in a Asp.Net
    textbox control using javascript. My page has the following:
    <form id="Form1" method="post" runat="server" onsubmit="return
    validateName(this);">

    and

    <script language="JavaScript"><!--
    function validateName(theForm)
    {
    var reEval = new RegExp("[\\\/\:\*?\"\<\>|]", "i");

    blnEval = reEval.test(theForm.txtName.Value)

    if (blnEval)
    {
    alert("A Valid name must not contain any of the characters
    \\/:*?\"<>|");
    return false;
    }
    else
    {
    return true;
    }
    }

    //--></script>

    where txtName is the id in the <asp:TextBox tag. Problem is
    1) The theForm.txtName.Value always gives undefined as the value instead
    of the actual valus in the textbox.
    2) When the Javascript returns true, the page does not submit.

    Help anyone?
    thanks!

    Matthew Wieder Guest

  2. #2

    Default Re: Client-Side Validation of asp:TextBox with Javascript

    Hi

    A quick glance
    theForm.txtName.value <---- value not Value

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Internet Client & Controls MVP
    ==============================
    "Matthew Wieder" <DevelopmentSatoriGroupInc.com> wrote in message
    news:3F1F006A.7010404SatoriGroupInc.com...
    > Hi - I'm trying to do client-side validation of the text in a Asp.Net
    > textbox control using javascript. My page has the following:
    > <form id="Form1" method="post" runat="server" onsubmit="return
    > validateName(this);">
    >
    > and
    >
    > <script language="JavaScript"><!--
    > function validateName(theForm)
    > {
    > var reEval = new RegExp("[\\\/\:\*?\"\<\>|]", "i");
    >
    > blnEval = reEval.test(theForm.txtName.Value)
    >
    > if (blnEval)
    > {
    > alert("A Valid name must not contain any of the characters
    > \\/:*?\"<>|");
    > return false;
    > }
    > else
    > {
    > return true;
    > }
    > }
    >
    > //--></script>
    >
    > where txtName is the id in the <asp:TextBox tag. Problem is
    > 1) The theForm.txtName.Value always gives undefined as the value instead
    > of the actual valus in the textbox.
    > 2) When the Javascript returns true, the page does not submit.
    >
    > Help anyone?
    > thanks!
    >

    Vidar Petursson Guest

  3. #3

    Default Re: Client-Side Validation of asp:TextBox with Javascript

    OK, you win points for the fast valid reply to part one of my problem -
    anybody know why the form wont submit?

    Vidar Petursson wrote:
    > Hi
    >
    > A quick glance
    > theForm.txtName.value <---- value not Value
    >
    Matthew Wieder Guest

  4. #4

    Thumbs up Re: Client-Side Validation of asp:TextBox with Javascript

    Check this out for More Validations :
    http://chamilaw.blogspot.com/2011/03/java-script-validations.html
    Chamila Guest

Similar Threads

  1. ASP.NET 2.0: Detecting if client-side validation javascript regist
    By Ben Fidge in forum ASP.NET Building Controls
    Replies: 0
    Last Post: March 16th, 02:09 PM
  2. Client Side Validation
    By trex0911 in forum Coldfusion Flash Integration
    Replies: 0
    Last Post: December 14th, 06:39 PM
  3. DatGrid TemplateColumn TextBox JavaScript ClientSide Validation?
    By Arulraja in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: November 14th, 10:29 PM
  4. Client-side Javascript validation of "select multiple" for PHP
    By Phil Powell in forum PHP Development
    Replies: 3
    Last Post: October 19th, 10:04 PM
  5. Replies: 0
    Last Post: June 25th, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •