Text field mysteries
[1/3] from: henrik::webz::dk at: 26-Apr-2004 14:05
Hi, all
I'm creating a text field which will display in a different color with
the text "Required!" for an address form.
The code:
view layout [
name-field: field [
either any [
0 = length? name-field/text
equal? name-field/text "Required!"
][
name-field/text: "Required!"
probe name-field/text ; shows up blank sometimes!
name-field/colors/1: 255.150.50
][
name-field/colors/1: 240.240.240
name-field/font/color: black
]
show name-field
]
]
When run, "Required!" is supposed to be displayed after you've skipped
through the field, but forgot to enter information. This works, if the
you don't enter anything and the field isn't dirty?.
When you enter something, that'll be displayed in the correct color, but
if you delete it again, I want "Required!" to be displayed again, but
only the color is correct, the field is blank. Probing name-field/text
gives "" just after I've set it in the code.
If I escape and do a
name-field/text: "Required!"
show name-field
manually, "Required!" shows fine. The behavior matches the contents of
the dirty? flag, but if I set it to none, the behaviour stil continues.
What's wrong?
--
Regards,
Henrik Mikael Kristensen
[2/3] from: ptretter:charter at: 26-Apr-2004 8:20
Use 'Copy.
Heres your same layout using 'COPY instead. Hope that is what you were
talking about.
-----------------------------------------------------------------
view layout [
name-field: field [
either any [
0 = length? name-field/text
equal? name-field/text "Required!"
][
name-field/text: copy "Required!"
probe name-field/text ; shows up blank sometimes!
name-field/colors/1: 255.150.50
][
name-field/colors/1: 240.240.240
name-field/font/color: black
]
show name-field
]
]
[3/3] from: henrik:webz:dk at: 26-Apr-2004 16:51
Paul Tretter wrote:
> Use 'Copy.
>
> Heres your same layout using 'COPY instead. Hope that is what you were
> talking about.
Damn... I fell for the old copy trick. :-) Works now.
--
Regards,
Henrik Mikael Kristensen