labelInfo does not work
labelInfo does not work
rf1234
Posts: 2,986Questions: 87Answers: 421
I am currently translating Editor. Have tried labelInfo and fieldInfo as well. While fieldInfo works, labelInfo doesn't do anything at all. Any ideas what I could do about this?
e.field( 'contract.instrument' ).label('Instrument:')
.labelInfo('hallo')
.fieldInfo('selber hallo');
I have just downloaded the latest Editor version and I use it with Bootstrap.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
labelInfo() and.fieldInfo() are properties of field() and fields(), not of label().
That's what I thought, yes.
This works for both label and fieldInfo:
This does not work for labelInfo (only for label):
This works for label and fieldInfo but not for labelInfo:
This also works for label and fieldInfo but not for labelInfo:
I must be missing something. I wouldn't have expected those results.
Sorry I can't be more help. No doubt Allan will enlighten us.
I guess so, tangerine
Now I tried something else. I set the labeInfo in the respective Editor instance - and it works.
Now I tried to change it programmatically later like this:
IT WORKS NOW but unlike fieldInfo it requires to be preset already in the Editor instance.
Now it gets really weird:
If i also want to change the label programmatically like this:
it doesn't work any longer. I cannot change label and labelInfo programmatically at the same time!!
Now I tried it with fieldInfo like this:
WORKS. So looks like labelInfo and label don't like each other. And labelInfo requires to be preset already in the Editor instance. while the others don't have this requirement.
I have to correct myself in one point. LabelInfo does NOT require to be preset in the Editor instance.
This works:
e.field( 'contract.instrument' ).labelInfo('test').fieldInfo('more testing');
If I add a line to also set label then labelInfo does not work any longer. Seems to get overwritten by label?!
e.field( 'contract.instrument' ).labelInfo('test').fieldInfo('more testing');
e.field( 'contract.instrument' ).label('Für:')
The second line makes the labelInfo disappear. fieldInfo still works.
I'm afraid that's a bug .
What is happening is that
field().label()
writes HTML to an element which also contains the label message. Therefore the label message element is removed and destroyed.I don't think there is actually a workaround for that at the moment - at least not that I can see. It's going to require a fix in Editor. I'll post back when I've made the required change.
Thanks for flagging this up.
Allan
if you use it for translation purposes and you do a page refresh each time someone changes the language the work around would be to have a variable in the Editor instance and assign the value to the variable before Editor is being called. That would effectively make field().label() redundant and you could still use field().labelInfo().
this is even easier and no additional variable needed:
Just a quick one to say that this has been resolved in source now, and will be included in 1.6.4 which will drop soon.
Regards,
Allan