When I call a method after leaving a field and want to force back the focus via elements.elementName.requestFocus() I noticed that the focus doesn’t go there?
I don’t know if this is intended (at least not wished for by me) or known?
When I call a method after leaving a field and want to force back the focus via elements.elementName.requestFocus() I noticed that the focus doesn’t go there?
I don’t know if this is intended (at least not wished for by me) or known?
What kind of view are you in?
Record/List or table?
Oh dear… Sorry for that. It is a TableView…
Ok that is a problem
Because currently request focus only really works in RecordView or list view (if you jump from input field to inputfield)
a solution for this limitation is on the planning.
OK no problemo! I am happy it is on the planning list…
fixed in 2.0RC10..
works now for record/list/tableview and in portals.
Well, it seems like this bug is back. Both functions: controller.focusField(‘fieldName’, true) and elements.fieldName.requestFocus() does not work on a forms of view property type Table View (locked). There is no focus gained at all, although (with the function: elements.fieldName.requestFocus()) you can see that the field has a white fore/background. But when you start typing nothing happens.
can you create a case then with a small sample solution?
I have the same problem but in Record view (Locked).
Version: 5.2.4 - build 1006
I set the requestFocus after each formfield onAction. Worked well all the time. Strange thing is, after a field is changed (onDatachange is called) the requestFocus seem to work again on all fields on the form.
We use some global functions to set the requestFocus so I looked in the code first. But after I couldn’t find anything changed that caused this behavior I created a onAction and set the requestFocus on the next field. This didn’t work.
This code should work right?
function nextField($jsEvent)
{
elements.naamextern.requestFocus();
}
that code seems fine but i don’t understand what you say here:
“the requestFocus seem to work again on all fields on the form.”
what does that mean? Why shouldn’t it work on all the fields?
but in ondatachange you call request focus to another field (and you dont return false in the ondatachange) but the focus doesn’t go to that other field but to …?
We use a global onAction and onDatachange on all fields on a form.
Our onAction calls a function to set the requestFocus on the next field (see code example) and it has always worked great.
But now after hitting enter on a field, you see the cursor moving to the next field and then it’s gone. (We have select on enter set on the fields but no field or text looks like it is selected). Strange thing is, if I change the field and hit enter, the onDatachange is triggered and after that I can hit enter on each field and it keep going to the next field without any problem.
code example:
function frw_Formfield_goNextField($obj) {
var $formName = $obj.formName;
var $elementName = $obj.elementName;
if ($elementName.substr($elementName.length-4)=="_oms") {
$elementName = $elementName.substr(0,$elementName.length-4);
}
if ((forms[$formName].metadata) &&(forms[$formName].metadata.form) &&(forms[$formName].metadata.form.tabSequence)) {
var $tabSequence = forms[$formName].metadata.form.tabSequence;
var $idx = $tabSequence.indexOf($elementName);
if (($idx != -1) &&($idx <($tabSequence.length - 1))) {
var $nextElementName = $tabSequence[$idx + 1];
if (forms[$formName].elements[$nextElementName] == null) {
throw { message: 'element does not exist ' + $nextElementName, category: 'internal', uuid: '' }
}
if (forms[$formName].elements[$nextElementName].readOnly == true || forms[$formName].elements[$nextElementName].enabled == false) {
frw_Formfield_goNextField( { formName: $formName, elementName: $nextElementName });
} else {
forms[$formName].elements[$nextElementName].requestFocus();
}
}
}
application.output($elementName+' '+$nextElementName)
}
Some more info I have is that when I set a breakpoint somewhere in the function, the requestFocus will work. Strange right?
i guess somewhere in the line also a stopUIEditing is called that will transfer the focus out of the newly focused field.
Can you create a case with a small example ?
jcompagner:
i guess somewhere in the line also a stopUIEditing is called that will transfer the focus out of the newly focused field.
Can you create a case with a small example ?
Done
Case: 347380