Hi,

I need to present a form where a text box displays something rather than
nothing when the associated value is empty, for example see the
behaviour of the search input at http://java.sun.com/.  This seems to be
much like the selection-list's null-text facility which obviously isn't
available on normal text fields.  I was wondering whether anyone could
point me to any existing examples and/or advice on how to achieve this
affect within the cforms framework?

An avenue I was looking into was to implement a converter to special
case the empty value but since I'm dealing with strings I'm put off by
the converter documentation saying "Strings obviously don't support any
convertors, since there's no purpose in converting a string to a
string".  I've also tried building javascript event handlers and
validators but managed to get myself in an infinite loop using the
following:
        <fd:on-value-changed>
                <fd:javascript>
                        <![CDATA[
                        if(this.value=='' || this.value==null) {
                                this.value = this.fieldDefinition.initialValue;
                        }
                        print('CHANGE ' + this.value);
                        ]]>
                </fd:javascript>
        </fd:on-value-changed>
        <fd:validation>
                <fd:javascript>
                        <![CDATA[
                        if(this.value==this.fieldDefinition.initialValue) {
                                this.value = null;
                        }
                        print('VALIDATE ' + this.value);
                        return true;
                ]]>
                </fd:javascript>
        </fd:validation>                        

Any thoughts and advice welcome :)

Thanks in advance,

Rob
  Rob Oxspring
  [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to