Detecting Blank form field

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Detecting Blank form field

    Hi there,

    I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes
    to my update stored procedure. The stored procedure expect values, so how
    can I detect if a form field was empty. I've tried testing to see if the
    form field is null, blank and to count the characters, but I can't get it
    working. My SQL table allows nulls, so it's not that.

    thanks in advance
    Charles


    www Guest

  2. Similar Questions and Discussions

    1. Detecting the lenght of a MEMO field retrieved from a SQL database
      Hi using VBScript, SQL, ASP I would like to show the contents of a memo field but only if it is not empty. I can do this with regular text...
    2. copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome?
      I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed...
    3. Detecting if a field is required
      Hi all, i need to detect whether a field is required or not. I'm using this code for building a string to convert later to an array (by Split) of...
    4. Detecting MEMO field
      Hi all, i'd like to know if there is some way to detect whether a field is of type MEMO (i'm using MS Access) so to behave accordingly placing a...
    5. Detecting email format in text field
      I have a database which can do a mail merge. The problem is that the mail merge will stop if there is an email such as "abc@hotmail.com." because...
  3. #2

    Default Re: Detecting Blank form field

    www,

    i assume you have:

    CREATE .....
    @a INT = NULL
    AS
    .......


    <%
    a = request.form("a")
    ........
    if a<>"" then passthevalueAtoSP

    %>

    hope it makes sence :)

    Best regards
    /Lasse



    "www" <charles@paltrack.co.za> wrote in message
    news:3f5ede91$0$64720@hades.is.co.za...
    > Hi there,
    >
    > I' m getting a (0x80040E2F) error, if I submit my form, with blank
    textboxes
    > to my update stored procedure. The stored procedure expect values, so how
    > can I detect if a form field was empty. I've tried testing to see if the
    > form field is null, blank and to count the characters, but I can't get it
    > working. My SQL table allows nulls, so it's not that.
    >
    > thanks in advance
    > Charles
    >
    >

    Lasse Edsvik Guest

  4. #3

    Default Detecting Blank form field

    Whether you are submitting the page back to itself, or to
    another page you could simply embed your submit within a
    logic structure.

    exp:

    If Request.Form("form_field1") <> "" AND _
    Request.Form("form_field1") <> "" Then
    'submit the form
    End If

    However it's always a good practice to make sure all
    values submitted to your database are in the correct
    format and then submit.

    exp:

    b_submit_form = True

    'I set all my variables first so I can reuse them later
    'or alter them as needed.

    d_date = Request.Form("form_field1")
    i_value = Request.Form("form_field2")
    s_comments = Request.Form("form_field3")

    'In this example I want to confirm that the entered value
    'is a date.

    If IsDate(d_submit_date) = False Then
    b_submit_form = False
    'you can reset the variable back to blank if you
    'refill the form later.
    d_submit_date = ""
    'you can also set an error message to display to the user
    s_error = s_error & "A date must be a valid date. "
    End If

    'In this example I want to confirm that the entered value
    'is a number.

    If IsNumeric(i_submit_value) = False Then
    b_submit_form = False
    s_error = s_error & "FormField2 must be a numeric
    value. "
    End If

    'In this example I want to confirm that the form field is
    'not blank.
    If s_comments = "" Then
    b_submit_form = False
    s_error = s_error & "FormField3 must be entered. "
    End If

    'Each form field Item would be checked to confirm proper
    'values then we can submit the form

    If b_submit_form Then
    'submit the form
    If Err.Description <> "" Then
    s_return_message = "The following error occurred: " &
    Err.Description
    Else
    s_return_message = "Thank you."
    Else
    s_return_message = s_error
    End If

    Of course everyone has there own ways of doing things,
    this is just how I do it to make sure everything is in
    order prior to submitting it to the database, and to let
    the user know when there are problems.

    Hope this helps,
    - Dale

    Dale J. Kovacs 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