If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#51986 by BLOMASKY
Fri Nov 01, 2019 4:12 pm
I know you said form field, but to share, I use this in my render scripts for queries, to set the cursor to the 1st field (which, in many cases, is a filter).

setTimeout (function () {
widget.element.find(".k-input").first().focus();
}, 400);
#51988 by RLJB
Sat Nov 02, 2019 6:59 am
Sorry guys doesn't work for me.. I tried the script on the FORM and the FORM section... no love. Any further tips?
#52639 by Jaymer
Wed Jan 08, 2020 3:28 pm
doesnt work for me

console error: VM32871:2 Uncaught ReferenceError: widget is not defined
at eval (eval at runScript (aware.js?V2709:1), <anonymous>:2:1)

I put this code in the Section Render Script - I have 3 Sections and need to set focus on a field when I click on the 2nd Section:
Code: Select allsetTimeout (function () {
widget.element.find(".k-input").first().focus();
}, 400);


For reference, we need to realize there are Init & Render scripts available for BOTH the Form and each Section (tab).
For testing, I actually put this in Form Render, and both Section Renders.
I get the same error. "widget" is not correct here
#52670 by BLOMASKY
Wed Jan 08, 2020 11:00 pm
AwareApp_FormParser.prototype.setFocus=function(sectionName) {
if (this.m_fields ) {
var firstTabIdx = null, focusSet = false;
for (var i = 0, len = this.m_fields.length; i < len; ++ i) {
var f = this.m_fields [i];
var tabIndex = f.getTabIndex ();
if (tabIndex && tabIndex == "1") {
firstTabIdx = f;
if ((! sectionName || sectionName == f.getSectionName ()) && f.setFocus ())
focusSet = true;
break;
}
}
if (! focusSet) {
for (var i = 0, len = this.m_fields.length; i < len; ++ i) {
var f = this.m_fields [i];
if (f != firstTabIdx && (! sectionName || sectionName == f.getSectionName ()) && f.setFocus ())
break;
}
}
}
}
#52678 by johntalbott
Thu Jan 09, 2020 12:44 am
If this just needs to work for the first tab of the form when it first opens, here is a simple approach.

Form Render Script

Code: Select allsetTimeout(function(){
     $("input[name=FirstName]").focus()
}, 500)
#52703 by BLOMASKY
Fri Jan 10, 2020 3:41 pm
Jaymer wrote:yuck !!!


You say "YUCK" but did I mention, that I have that in a "custom.js" file in my custom folder and I don't have to do anything to each form? This is a global function that will always set the cursor into the 1st field of each and every form with out any scripts in each one?

Did I mention that?
Does it still have the "yucky" feel Jaymer?

Bruce

Who is online

Users browsing this forum: PointsWell and 6 guests