This topic is locked

check a field before updating the table

10/20/2008 2:04:37 PM
ASPRunnerPro General questions
P
Pistelli2001 author

Hi!!
Let me check a field before updating the table

Table "proposal" has the following fields
keyprop

name

dataproposta

id_stato
id_stato can have 1 or 2 or 3
id_stato is a numeric field, and if > 1 should not update the table.

I entered this code in
Edit Page - Before record update
Function BeforeEdit(dict, where, oldvalues,keys,message,inline)
liv = (SESSION("GroupID"))
If liv = 1 or dict("id_stato") > 1 then

BeforeEdit = false

Response.Write "False"

else

BeforeEdit = True

Response.Write "True"

end if
is Id_stato the problem?
thanks

J
Jane 10/23/2008

Hi,
your code looks correct.

Please make sure your field names are correct in the code. Field names are case sensitive here.

P
Pistelli2001 author 10/23/2008

I solved this way but dict (field) is not working:
Sub BeforeShowEdit(smarty,templatefile)

'** Custom code ****

' put your custom code here
SESSION("Idstato") = dbvalue(rs("Id_stato"))
Function BeforeEdit(dict, where, oldvalues,keys,message,inline)

'** Custom code ****

' put your custom code here

fil= SESSION("FilID")

are= SESSION("AreaID")

liv = SESSION("GroupID")
If (SESSION("Idstato") > 1 and liv = 1)or (SESSION("Idstato") > 2 and liv = 2) then

BeforeEdit = false
'Response.Write "False"

else

BeforeEdit = True
end if
Thanks