Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Validation

    Hello all,

    I'm very new to ASP.NET and I am using VS.NET to write my pages.

    I am using the Regular Expression Validator on my form and I would like it
    to check a field to make sure it does not equal 0. Can anyone point me to
    some resources with this type of information?

    Thanks,

    - J


    Jay Guest

  2. Similar Questions and Discussions

    1. CFFORM validation trumping Custom Validation
      Is there any way for custom form validation to work in concert with the cfform validation? I have a custom script that compares the values of two...
    2. CFFORM Validation trumping Custom Form Validation
      Is there any way for custom form validation to work in concert with the cfform validation? I have a custom script that compares the values of two...
    3. 'Either Or' Validation
      This might not be an advanced topic, but I need to be able to validate an HTML form, and for that matter, Flash forms, to check that the user...
    4. validation summary doesnt display when there's client-side validation
      I have a custom validator that validates a numeric field, txtField, that allows for thousand separators. I also placed a validation summary so...
    5. only custom validation control does server side validation?
      On a CustomValidator you have to provide the validation code because otherwise it doesn't know what to do for the validation. Other validator...
  3. #2

    Default Re: Validation

    While you could use a RegExVal for this and check for [^0] or something, you
    could also use a requiredfieldvalidator and set the initialvalue="0"

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsRequiredFieldValidatorC lassInitialValueTopic.asp[/url]

    Karl

    "Jay" <jerry280@yahoo.com> wrote in message
    news:eWCJ5TvSDHA.1036@TK2MSFTNGP10.phx.gbl...
    > Hello all,
    >
    > I'm very new to ASP.NET and I am using VS.NET to write my pages.
    >
    > I am using the Regular Expression Validator on my form and I would like it
    > to check a field to make sure it does not equal 0. Can anyone point me to
    > some resources with this type of information?
    >
    > Thanks,
    >
    > - J
    >
    >

    Karl Seguin Guest

  4. #3

    Default Re: Validation

    That work perfectly!

    Thanks!

    - J

    "Karl Seguin" <kseguin##crea.ca> wrote in message
    news:ufYnEtvSDHA.2852@tk2msftngp13.phx.gbl...
    > While you could use a RegExVal for this and check for [^0] or something,
    you
    > could also use a requiredfieldvalidator and set the initialvalue="0"
    >
    >
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIWebControlsRequiredFieldValidatorC lassInitialValueTopic.asp[/url]
    >
    > Karl
    >
    > "Jay" <jerry280@yahoo.com> wrote in message
    > news:eWCJ5TvSDHA.1036@TK2MSFTNGP10.phx.gbl...
    > > Hello all,
    > >
    > > I'm very new to ASP.NET and I am using VS.NET to write my pages.
    > >
    > > I am using the Regular Expression Validator on my form and I would like
    it
    > > to check a field to make sure it does not equal 0. Can anyone point me
    to
    > > some resources with this type of information?
    > >
    > > Thanks,
    > >
    > > - J
    > >
    > >
    >
    >

    Jay Guest

  5. #4

    Default validation

    Hi all!

    Can you please help me here?

    I need to validate a form with get method and textarea input....

    I tried

    A)
    <script Language="JavaScript">
    function validRequired(formField,fieldLabel)
    {
    var result = true;

    if (formField.value == "")
    {
    alert('Invalid entry. Please type information.');
    formField.focus();
    result = false;
    }

    return result;
    }
    function validateForm(theForm)
    {
    if (!validRequired(theForm.question,""))
    return false;

    return true;
    }
    </script>


    <cfoutput>
    <FORM ACTION="#ActionURL#" METHOD="GET">

    <TR>
    <TD><!---<INPUT TYPE="TEXT" NAME="question" VALUE="<CFIF
    IsDefined("question") AND question NEQ "">#question#</CFIF>" >&nbsp;</td>--->
    <textarea name="question" rows="2" cols="30" MAXLENGTH=""><cfif
    isDefined("url.question")>#Trim(url.question)#</cfif></textarea>
    </TD>
    <td>&nbsp;&nbsp;</td>&nbsp;
    <TD valign="bottom">
    <INPUT TYPE="Submit" NAME="Submit" VALUE="Search">
    </TD>
    </TR>
    </FORM>
    </cfoutput>

    B) I also tried server-side validation:

    <cfscript>
    if (Len(Trim(url.question)) EQ 0)
    {
    var_error = "Please enter keyword for search.";
    break;
    }
    </cfscript>

    None of these worked....
    Thanks

    odette007 Guest

  6. #5

    Default Re: validation

    In your JS example, you don't seem to be calling validateForm() anywhere to
    get the whole process going. Add an onSubmit handler to the form tag:

    <FORM ACTION="#ActionURL#" METHOD="GET" onSubmit="return validateForm(this)">

    Bryan

    blewis Guest

  7. #6

    Default Re: validation

    Thanks, I tried that and is not working...It directs me to the next page without throwing an error message prior to that.. Whoud it matter since I pass variable as url? I don't think so...
    odette007 Guest

  8. #7

    Default Re: validation

    The error is probably there, but the browser is just skipping it and
    submitting anyway. I highly recommend using Netscape/Mozilla/FireFox for JS
    debugging and opening up the JavaScript console. This gives you much more
    information about JS problems than IE does.

    You may also want to change:

    if (!validRequired(theForm.question,""))
    return false;

    return true;
    }

    to:

    if (!validRequired(theForm.question,"")) {
    return false;
    } else {
    return true;
    }

    just to be explicit about the if blocks.

    blewis Guest

  9. #8

    Default Re: validation

    As long as you can be sure that your user has javascript enabled, try changing
    your submit button:

    <INPUT TYPE="Submit" NAME="Submit" VALUE="Search">

    to

    <INPUT TYPE="button" name="btnSubmit" value="Search"
    onClick="validateForm(this.form);">

    then change the validateForm function to:

    function validateForm(theForm)
    {
    if (validRequired(theForm.question,""))
    {
    theForm.submit();
    }
    }

    You also want to be careful using name="submit" becuase you can sometimes
    create bump into a reserved word issue.

    AnoPres Guest

  10. #9

    Default validation

    Hi,

    I'm using Yaromat for validation the update form

    It works fine.
    but you can't validate on like this example
    for example
    if checkbox = true
    messagebox " textbox is mandantory"
    end if

    is there a way to do this?

    please advise
    kisoen




    rajesh Guest

  11. #10

    Default Validation

    Have a few questions for anyone out there who has a answer or who can point me
    in a direction to find the answers.
    The one thing that really bugs me in Dreamweaver is there open ended
    statements. Like:
    The tag: "td" doesn't have an attribute: "width" in currently active
    versions.[XHTML 1.0 strict] I ask myself? OK, so give me a solution to the
    problem? maybe im missing something but when I come across something like this
    where should I go to get a answer?
    I keep thinking there should be some kind of button " Fix It" in dreamweaver...
    Thanks

    vortexweb Guest

  12. #11

    Default Re: Validation

    It means you're trying to use the 'width' attribute in a <td> tag, which
    isn't valid according to the DTD that you're using (XHTML 1.0 strict). The
    answer is to get rid of the 'width' attribute and replace it with CSS.



    vortexweb wrote:
    > Have a few questions for anyone out there who has a answer or who can
    > point me in a direction to find the answers.
    > The one thing that really bugs me in Dreamweaver is there open ended
    > statements. Like:
    > The tag: "td" doesn't have an attribute: "width" in currently active
    > versions.[XHTML 1.0 strict] I ask myself? OK, so give me a solution
    > to the problem? maybe im missing something but when I come across
    > something like this where should I go to get a answer?
    > I keep thinking there should be some kind of button " Fix It" in
    > dreamweaver... Thanks

    rob::db Guest

  13. #12

    Default Re: Validation

    I have one more request of anyone out there.
    when I go to place a flash file on my doc. dreamweaver adds a embed statment
    to the code, this statment is: The tag name: "embed" Not found in currently
    active versions.[XHTML 1.0 transitional]

    Do you know away around this??


    vortexweb Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139