Is there a way to manipulate the ‘text’ property of a named element the way you can manipulate ‘toolTipText’ and ‘fgcolor’?
forms.[formname].elements.[elementname].text
Doesn’t work here.
‘toolTipText’ is a elements property, ‘text’ is not, so I am not suprised that it doesn’t work. Maybe we are talking about two different things.
here is the code:
controller.newRecord();
controller.saveData();
// fill data providers with tool tip text
var e = elements.length;
for (i = 0; i < e; i ++)
{
controller.setDataProviderValue(elements[i].getDataProviderID(), elements[i].toolTipText);
application.output(elements[i].text);
elements[i].fgcolor = globals.mutedText;
}
// request focus for the first data element
elements.firstFocus.requestFocus();
The first line within the for statement fills the data provider with the tool tip text. The second line gives me a ‘null’ result.
Bob:
I should also add that the elements I am manipulating are fields and not labels. Therefore there is no text property to read or write. I was hoping that I could use the text property of the field, but aparently that is not possible. Off to Feature Request.
Thanks!
Thomas,
LABELS have a text property. FIELDS have data. If you have a FIELD on your form (called “fld_city”) that holds the DATA of the “city” field - and you want to change the DATA from “Los Angeles” to “San Francisco” here’s the code:
city = 'San Francisco'
Objects on a form (i.e. fields, lablels, etc) are just that - OBJECTS. Those objects are bound to the actual DATA.
Hope this helps clear things up.
I’m not exactly sure what you are after, but I believe fields are objects of the elements class and so do have a text property. If it isn’t the dataprovider value you wish to controil, but rather the actual value of the text property, you can do this as you can the other properties of elements. This might be useful if you wanted to control column heading labels in a table view.
Thanks for your replys.
I have a form for address entry.
That form has the standard data providers street, street2, city, state, zip,
country.
I don’t want to use labels to describe the fields in order to save screen real estate. There is a lot of other contact information that also needs to be displayed.
Instead of placing a static label to the left of a field I ‘place’ them inside the field, dynamically. That way the user still knows where to enter what. BTW: I got this idea from another discussion here in the forum. HJK, David? I don’t remember.
The label information I place into the field is read out of the toolTipText property. This work very nicely and I am very pleased with my little self!
I would be even happier, if I could reserve the ‘toolTipText’ for a longer descriptive text (‘Enter street name here without making a mistake, or else.’) to be shown as the tool tip text and use the ‘text’ property for my dynamic label (‘Street’). In designer, I can type stuff into the ‘text’ property - even of a field - so why not put it to use? I have posted a feature request to that extend.
I know now that this is currently not possible and it is not a big deal, but it would be nice to have.
AH! Right - I get it now. Cool idea.