transparent entry fields

I would like to format fields on a form so that the input field is transparent if empty so that a label behind it can show through explaining what data should be input. When data is entered, however, the label should not show through the field. How can this be accomplished?

With the event onRecordShow you could set the transparantie of the fields to true or false, depending on contents.

Then with the event onChange (or maybe onEnter/focusGained) you could set the transparantie again (true or false)

I have a List view form displaying a found set. OnRecordEdit of this form I display a record form in a dialog for the selected record, so far this works.
Now I want to make some of the fields transparent in the record form based upon whether or not they are blank. I created a method that sets the transparent property of each field.

if(forms.namefirst != ‘’)
{
forms.namefirst.transparent = false;
}
else
{
forms.namefirst.transparent = true;
}

and placed it on the OnShow event of the record form.
When I click on a line in the list form I get an error message that states the form method could not execute because “The undefined value has no properties.” Which value?? :?
Also
The Developer docs say that when OnShow event is used, data from the current found set is not available yet. Both the record and list forms are based upon the same table. Does the restriction still apply?

Hi,

I did the following test in CRM example which worked.

  1. in the companyList onRecordEdit>>
    forms.companyDetails.controller.loadRecords(foundset)
    application.showFormInDialog( forms.companyDetails)

  2. in formDetails onShow>>>
    if(url) /* see note
    {
    elements.url.transparent = false
    }
    else
    {
    elements.url.transparent = true
    }

*note:
if(url) this means >> if url != null AND url != ‘’
When you create a new record, most of your columns are ‘filled’ with null instead of ‘’. This means that your check url != ‘’ will return true, while you actually want it to return false.

Hope this helps.

I have taken maarten’s suggestion and made the change:

// test for data in fields

if(namefirst)
{
elements.namefirst.transparent=false;
}
else
{
elements.namefirst.transparent=true;
}

but now get an error that namefirst is not defined.

Using debug, I can tell that the error occurs after the statement elements.namefirst.transparent=false; .

The method is triggered onShow. I get this error now while moving back and forth from Design mode.

Do you also get this error when staying in data mode and going from, let’s say, formList to formDetails?

(I’ll have a closer look at the errors when toggling between Designer and Datamode in combination with onShowScripts. )

when I go from List to the detail form I get the message attached. When I click on “OK” the detail record shows briefly in the dialog box and then Developer hangs requiring me to cancel from the Task Manager.

Here’s a small sample solution that more or less does what you want (I hope :wink: )

Please have a look and see if you can match this with your code.
If this doesn’t work, send me your exported solution and I’ll be happy to see if I can track any bugs/mistakes.

I’ve looked into your solution and noticed that the elements in your form called “name”, don’t have the name-property entered.

if you want to do…
elements.namefirst.transparent=false;

…then you must enter the name property of the field
(go into designer, select the field and look for the name property
in the property list)

This solves the problem. :)

Thanks Maarten! I’ll have to remember to name the elements if I’m going to use them in a method (right click cut and paste from the dataprovider property would be nice :wink: )
Super support!

you’re welcome.
(I was under the impression you clicked your elementsCode into your script, so didn’t think of this pitfall in the first place)

(right click cut and paste from the dataprovider property would be nice )

hmm, interesting…I’ll see if dev team will buy it :wink:
BTW: when placing your field into a form(Specify field Dialog) there’s an option to autofill your name property / text property