Validation of records

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Validation of records

    How can i validate if a record number in the Database NOT exist, and that an
    error message will be returned to the user,
    that a wrong number has been entered.

    The code i'm having sofar is :
    <cfparam name="FORM.issue_number" default="1">
    <cfquery name="rs_issue" datasource="issue">
    SELECT *
    FROM tbl_issue
    WHERE issue_number = #FORM.issue_number#
    </cfquery>

    whatsaname 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 of records

    Run a select query and use the recordcount variable.

    Or run a select count(fieldname) as thecount query with the appropriate where
    clause and use the queryname.thecount value.

    Originally posted by: whatsaname
    How can i validate if a record number in the Database NOT exist, and that an
    error message will be returned to the user,
    that a wrong number has been entered.

    The code i'm having sofar is :
    <cfparam name="FORM.issue_number" default="1">
    <cfquery name="rs_issue" datasource="issue">
    SELECT *
    FROM tbl_issue
    WHERE issue_number = #FORM.issue_number#
    </cfquery>



    Dan Bracuk Guest

  4. #3

    Default Re: Validation of records

    <cfparam name="FORM.issue_number" default="">
    <cfquery name="rs_issue" datasource="issue">
    SELECT *
    FROM tbl_issue
    WHERE issue_number = #FORM.issue_number#
    </cfquery>

    <cfif not rs_issue.recordcount>
    No records found.
    </cfif>

    _silence Guest

  5. #4

    Default Re: Validation of records

    I'm not that familar with database quiries rahter than the simple recordsets.
    I've tried to find how to make the quiry that runs the RECORDCOUNT, but i can
    not find that.
    Could you please assist me a bit?

    Thanks

    whatsaname Guest

  6. #5

    Default Re: Validation of records

    All queries ran with cfquery return the following variables in the query scope:
    query_name.currentRow
    Current row of query that cfoutput is processing
    query_name.columnList
    Comma-delimited list of the query columns
    query_name.RecordCount
    Number of records (rows) returned from the query
    cfquery.ExecutionTime
    Cumulative time required to process the query

    They can all be referenced in CF after the query is executed by using
    query_Name.recordcount (where query_Name is the actual name of your query),
    etc...

    For more information see:

    [url]http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-b19.htm[/url]

    _silence Guest

  7. #6

    Default Re: Validation of records

    Thank you so much, now i've got the clue, and it is working.
    I've place the CFIF where thhe output is expected
    ("<cfoutput>#Form.issue_number# <cfif not rs_issue.recordcount>
    DOES NOT EXIST</cfif></cfoutput>"

    Again Great Help.

    whatsaname Guest

  8. #7

    Default Re: Validation of records

    That is a good one. Thanks for your help.
    whatsaname 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