Skip to main content
March 14, 2011
Answered

Form Editing Error

  • March 14, 2011
  • 2 replies
  • 2027 views

Hi,

I have created a form with all the requirements, upon hitting the edit link, the form is redirecting to the correct page, but, it is showing all the active entries in the table, rather than just the entry to be edited. I have tried using a cfif with entryid as an argument, without effecting the output.

<cfif entryid EQ #entryid#>

I have used the following format:

<cfinclude tags>

<cfquery to query the tablein the database>

<form to show the user same form used to enter the information>

<cfquery with update and set statements>

<some form validations>

Please help. Thanks in advance,

Vijayvijay77.

    This topic has been closed for replies.
    Correct answer ilssac

    I have tried using entryid in the query itself, but it is popping out an error saying entryid Undefined.

    Thanks.


    Which it will be until you define it.

    We all expect that you have some page, BEFORE the update form that an user can select what record to edit.

    Usually on that page, the KEY ID of the record the user has selected will be passed as a GET (AKA URL) variable, ususally with a link:

    I.E.

    <a href="formEditPage.cfm?entryid=#someQuery.entryID#">Edit Record #someQuery.entryID#</a>

    OR

    In a POST (AKA FROM) variable.

    <input name="entryID" type="..." value="#someQuery.entryID#">

    There are other, more sophisticated ways to make this basic MASTER -- DETAIL application.  But these examples are where most developers start.

    2 replies

    Inspiring
    March 14, 2011

    What variables are you passing with this edit link you mention?  How are you then using these variables?

    WolfShade
    Legend
    March 14, 2011

    First of all, "<cfif entryid EQ #entryid#>" is incorrect; don't use ## around a variable name unless it's within a string; and this also is the same as saying "IF 1 eq 1", because you are comparing a string to itself.

    Pass the ID in the query, so there is a "WHERE column = #id#" so you will get only one record from the database.  Your CFOUTPUT is outputting every record in a multiple records return.  At least, that's the way it seems to me.

    ^_^

    March 14, 2011

    I have tried it, its not working though.

    I have used in the <cfquery> tag where entryid is not null and entryid eq #entryid#; but it didn't work.

    I have tried using maxrows option in the <cfoutput> tag, it displays only one entry, but not the opted one.

    Thanks for your suggestion though.

    Vijayvijay77.

    Owainnorth
    Inspiring
    March 15, 2011

    I think you need to post up the actual query you're doing here, if it's returning too many rows then it's a missing or incorrect where clause.