This topic is locked

Access to readonly field in Events

8/6/2009 1:49:21 PM
ASPRunnerPro General questions
T
Tim author

Hello,
I have 2 fields in my table: notes and newnote. When someone edits a record I'd like to show the notes field as readonly and have the newnote be a text area. Then, when they save, I'd like to add the text from the newnote field to the notes field and clear the newnote before submitting. Here is my code, which I put in the Before record updated event of the edit page:
if dict("NewNote") <> "" then

dict("Notes") = "<font size=1><b>Added: " & Now() & "
" & "By: " & Session("UserName") & "</b></font>
" & dict("NewNote") & "
" & "--------------------------" & "
" & dict("Notes")

dict("NewNote") = ""

end if
If the notes field is not readonly this works great. If it is readonly it does not add the orginal notes. I assume that this is because dict("Notes") is not available for readonly fields. So my question is how should I accomplish what I'm trying to do?
Also, (sorry for 2 questions in one post, but I think it's quick) it seem that if I make a field HTML on the list page the "Truncate large text fields (More... link)" doesn't work. Is that true?
Thanks,

Tim

J
Jane 8/7/2009

Tim,
readonly values are in the oldvalues array:

oldvalues("Notes")


"Truncate large text field" option doesn't work for HTML fields.

It's not possible to truncate HTML code properly. Number of characters includes both text and HTML.

C
clig 8/10/2009

Hello,

I have 2 fields in my table: notes and newnote. When someone edits a record I'd like to show the notes field as readonly and have the newnote be a text area. Then, when they save, I'd like to add the text from the newnote field to the notes field and clear the newnote before submitting. Here is my code, which I put in the Before record updated event of the edit page:
if dict("NewNote") <> "" then

dict("Notes") = "<font size=1><b>Added: " & Now() & "
" & "By: " & Session("UserName") & "</b></font>
" & dict("NewNote") & "
" & "--------------------------" & "
" & dict("Notes")

dict("NewNote") = ""

end if
If the notes field is not readonly this works great. If it is readonly it does not add the orginal notes. I assume that this is because dict("Notes") is not available for readonly fields. So my question is how should I accomplish what I'm trying to do?
Also, (sorry for 2 questions in one post, but I think it's quick) it seem that if I make a field HTML on the list page the "Truncate large text fields (More... link)" doesn't work. Is that true?
Thanks,

Tim


Capture the field in an onload event to a session var then you could use a before edit / after edit event to capture the dict of the new note field a new session AND them together or any old way useing string detection...