PDA

View Full Version : Result.ErrorHTML does not work


ABC123

Mike Reed
09-03-2009, 01:58 PM
I have this code in a grid in the CanInsertRecord event. It does not work. Can someone offer some ideas?

If I leave out lines 9 thru 12, it runs fine, but these lines are make sure the user enters the ssn number twice correctly. If the items are not the same then it should error out. What happens is that no record is added and the redirect page kicks in.

thanks,
mike

function CanInsertRecord as v (DataSubmitted as P, Args as p, PageVariables as p, Result as p)
with PageVariables
Result.Cancel = .f.
Result.ErrorHTML = ""
vfei1 = remspecial(DataSubmitted.Fei)
vfei2 = remspecial(DataSubmitted.Ssn)
vfeitype = alltrim(DataSubmitted.Feitype)
''
if vfei1 <> vfei2 then
Result.Cancel = .t.
Result.ErrorHTML = "The FEI and FEI Repeat fields do not match"
end if
'
if vfeitype = "EIN" then
DataSubmitted.Fei = Left(vfei1,2) + "-" + right(vfei1,7)
else if vfeitype <> "EIN"
DataSubmitted.Fei = Left(vfei1,3) + "-" + substr(vfei1,4,2) + "-" + right(vfei1,4)
end if

mmaisterrena
09-04-2009, 04:44 AM
if vfeitype = "EIN" then
DataSubmitted.Fei = Left(vfei1,2) + "-" + right(vfei1,7)
else if vfeitype <> "EIN"
DataSubmitted.Fei = Left(vfei1,3) + "-" + substr(vfei1,4,2) + "-" + right(vfei1,4)
end if


remove the 'if vfeitype <> "EIN"' from the 'else' line

Else already implies that everything that is different from the logical expression (vfeitype = "EIN") will enter into the 'else' statement.