Tomasz
|
| Posted: 04/29/2002, 1:26 AM |
|
one of my fields is label type and is changed to textbox depending on condition. The condition is the presence of any value in the pk field. It works, but until validation takes a role;
After displaying error message, this field changes to label again and resets to null. What is strange, pk field still have no value (I've printed it on screen), so as condition says - my field cannot be label! But it is. If I complete the form and send it, record is added with my field empty.
Any idea?
btw; condition is in before show event
|
|
|
 |
Nicole
|
| Posted: 04/29/2002, 6:46 AM |
|
Tomasz,
what is the condition depending on you change the field control type?
|
|
|
 |
Tomasz
|
| Posted: 04/29/2002, 12:20 PM |
|
Condition is presence of any data in user_id field of record form.
If this field is empty, record form display textbox instead of label.
After choosing person in grid, record form display label.
In the effect, user cannot edit this field when editing user, but is allowed to enter value when adding new user. (it's login field)
|
|
|
 |
Nicole
|
| Posted: 04/30/2002, 3:31 AM |
|
Tomasz,
ok, I see that the field is to be Label in update mode and is to be textbox in Insert mode. I don't know what exact code do you use, but try this one to conditionally set login field to textbox (Before Show event, ASP):
if GetParam("primary_key_field") = "" then
fldlogin = "<input type=""text"" name=""login"" maxlength=""50"" value="""" size=""50"">"
end if
|
|
|
 |
Tomasz
|
| Posted: 04/30/2002, 1:05 PM |
|
Nicole,
As I wrote before, changing field type works (update/insert mode), but in case of error message (any field validation), field is changed to label again, and it's content is deleted. In effect, user cannot complete the form.
Look at screenshots:
<a href="http://hallo.com.pl/cc/insert_mode.jpg>Insert mode; field "login" is a text box</a>
<a href="http://hallo.com.pl/cc/update_mode.jpg>Update mode; field "login" is a label</a>
<a href="http://hallo.com.pl/cc/validation_message.jpg>Validation error; field "login" became label again, and is empty (user_id too)</a>
(In the last case formheader is also blank, becouse I use variable to display it's content)
|
|
|
 |
Nicole
|
| Posted: 05/24/2002, 12:38 AM |
|
Tomasz,
I see that there's some interest on this issue..
Here is workaround.
It happens (label fields becomes label) because Before Show event code is executed if s<form_name>Err variable is empty. If it contains error messages, it is not empty, thus Before Show just do not executes.
The workaround is to put this code not into before show even but into Before Show Insert, Before Show Delete and Before Show Update events
|
|
|
 |
|