This topic is locked

Question on edit form

2/21/2007 9:59:08 AM
ASPRunnerPro General questions
G
gnabi author

I would like a field as readonly on Edit form but editable on the add form. Here is an example; Assume I have a Clients table with follwoing fields:

  1. ClientId
  2. Client Name
    Here is what I want:

    When a user add a new record he/she should be able to enter both ClientId and Client Name. But when edit a record I do not want them to change ClientId and they can still edit Client Name.
    I used follwoing as a workaround and it works with MS Access but not MYSQL. I defined a dummy clientId in select as follows:

    SELECT ClientId,ClientName, ClientId as ClientId_dummy from CLIENTS
    Then used ClientId in add form and ClientId_dummy in Edit form. Making ClientId_dummy as readonly. This works perfectly with MS Access but it does not work with MYSQL. Here is the error I get when I try to save a record in edit mode:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

    [MySQL][ODBC 3.51 Driver][mysqld-5.0.27-community-nt]Unknown column 'ClientId_dummy' in 'where clause'

    clients_edit.asp, line 845
    Please let me know how I can fix this. Thanks, gnabi

J
Jane 2/22/2007

Hi,
please post your connection string from include/dbconnection.asp file here and I'll help you to fix this issue.

G
gnabi author 2/22/2007

here you go.
strConnection = "DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=MyDB;SERVER=localhost;UID=test;PASSWORD=test;PORT=;OPTION

=3;STMT=;"
Thanks Jane for your help.

K
kconzel 2/23/2007

I'm just wondering why you can't specify on the edit page in the Visual Editor step that the Client ID properties are set to "read only"?

Will this work for you?

I would like a field as readonly on Edit form but editable on the add form. Here is an example; Assume I have a Clients table with follwoing fields:


  1. ClientId
  2. Client Name
    Here is what I want:

    When a user add a new record he/she should be able to enter both ClientId and Client Name. But when edit a record I do not want them to change ClientId and they can still edit Client Name.
    I used follwoing as a workaround and it works with MS Access but not MYSQL. I defined a dummy clientId in select as follows:

    SELECT ClientId,ClientName, ClientId as ClientId_dummy from CLIENTS
    Then used ClientId in add form and ClientId_dummy in Edit form. Making ClientId_dummy as readonly. This works perfectly with MS Access but it does not work with MYSQL. Here is the error I get when I try to save a record in edit mode:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

    [MySQL][ODBC 3.51 Driver][mysqld-5.0.27-community-nt]Unknown column 'ClientId_dummy' in 'where clause'

    clients_edit.asp, line 845
    Please let me know how I can fix this. Thanks, gnabi

G
gnabi author 2/25/2007

Thanks. I am using ASPRunner 4.0 and I have not used 4.1. So I am not sure if it will work. Thanks, gnabi

W
waynes 2/25/2007

I'm just wondering why you can't specify on the edit page in the Visual Editor step that the Client ID properties are set to "read only"?

Will this work for you?


I tried that but seems there is either a bug or an unusual design feature. If I make a field readonly on the edit page, it becomes read only on the add page as well & vica versa. I tried moving the field to a different location on the page, thinking that the edit and add page replicate each other until changed, but that didn't help either. So what gives? is this a bug or designed that way? I assumed that each page operated independently but I may be wrong. The only other option is to use a bit of javascript in the onload event to make the field readonly.

G
gnabi author 3/10/2007

Thanks all for the help. I tried looking through the code and can not make it work.
Jane, you asked me to post the connection string and I did in previous update. Do you have any solution which I can try. Please let me know. Thanks, gnabi