This topic is locked

Cannot copy key values?

4/18/2008 4:16:33 AM
ASPRunnerPro General questions
K
khyj author

Tried to use copy to dub a record, found that the new record is filled with all fields except the key field.
How to dub the key also? It is nice to have it 'pre-typed' as other fields do, in Add New Record page.
Thanks.

J
Jane 4/18/2008

Hi,
use Add page: Before display event to fill key field.

Here is a sample code:

if request.querystring("copyid1")<>"" then

smarty("value_FieldName") = request.querystring("copyid1")

end if



where FieldName is your actual field name.

K
khyj author 4/20/2008

Thanks.
Tried to add the code into Add page: Before display, but the field was not filled.

Comment out the if-condition, nothing returned.

Add code in Add page: AddOnLoad... nothing again.
The parameter copyid1 clearly had something as shown in the querystring of the URL passed in, however, it does not return anything even when printed (using Response.Write).
The field was to be editted as a short date format in the Add page.
The code copied in Add page: Before display is like this:

if request.querystring("copyid1")<>"" then

smarty("in_date") = request.querystring("copyid1")

end if


Thanks.

J
Jane 4/22/2008

Hi,
please make sure that you've replaced only FieldName with your actual field name in the code:

if request.querystring("copyid1")<>"" then

smarty("value_FieldName") = request.querystring("copyid1")

end if

K
khyj author 5/6/2008

Oh... yes.. I missed the signature.

It works now.

Thanks!