-
Setfocus issue
Hi Guys
We are trying to add a record and then switch focus to the first input field. Doing this in JS.
The add works fine but the focus doesn't
Lianja.showDocument("page:pagecustomer?action=add" ); WORKS
Lianja.showDocument("page:pagecustomer"); WORKS
Lianja.showDocument("section:section1"); WORKS
Lianja.Get(“pagecustomer.section1.txtTitle”).setfo cus(); DOES NOT WORK
Can anyone see anything wrong with the last line? There is no space in Setfocus
Thanks in advance
Simon
-
try setFocus()
notice the capitalized F
Hank
PS: when you are in the browser debugger, from the console it's easy to a) set a breakpoint and b) try out alternatives.
-
Hi Simon,
setfocus() and setFocus() are both available.
Asit turns out there was an issue with setting focus on a canvas field in that last beta which I have corrected in the next build.
-
Hi Guys
Still cannot get to the bottom of the setfocus issue.
There seem to be 2 versions of the syntax :
Lianja.get("page1.section2.field1").setfocus()
Lianja.get("page1.section2").field1.setfocus()
Looking at the two, the first one looks right but creates an error. The second doesn't evaluate to an object.
************************************************** **************************
In this example, the full name of the field in the field properties editor is "pagecustomer.tabcustomer.txtname". It is a field in a tabview section.
Lianja.get(“pagecustomer.tabcustomer.txtname”).set focus();
Parsing error
Lianja.get("pagecustomer.tabcustomer").txtname.set focus();
TypeError: Result of expression 'Lianja.get("pagecustomer.tabcustomer").txtname' [undefined] is not an object.
Anyone have any thoughts?
Thanks
Simon
-
Hi Simon,
Lianja.get(“pagecustomer.tabcustomer.txtname”).set focus();
not
Lianja.get(“pagecustomer.tabcustomer.txtname”).set focus();
and this is incorrect syntax.
Lianja.get("pagecustomer.tabcustomer").txtname.set focus();
invalid reference to txtname.
Use the proper LOM syntax.
Lianja.get("pagecustomer.tabcustomer.txtname")
-
If you have issues please submit tickets not direct email. That way we all see the ticket and can monitor the conversation.
There was an issue with setFocus() and this has been fixed in the next pre-release build which we have provided you with access to.
-
Hi Barry
Thanks for the reply.
Based on your response, the correct syntax is :
Lianja.get(“pagename.sectionname.textboxname”).set focus();
Which is what we thought.
Running 5.0RC57, we have checked the fullname of the textbox and the above syntax always produces a parse error at both saving the file and running it in desktop. Does setfocus() only work at runtime?
Stumped.
Cheers
Simon
-
Hi Simon,
I assume that the space between set and focus is a typo in the message, not a typo in your .js file.
Hank
-
Hi Hank
Yes - the forum does that sometimes. setfocus is one word.
Interestingly we changed the name of the textbox and then chaged it back again (thinking it might have saved an extra space) and now no save or parse error but just nothing happens in terms of setting the focus in dev or runtime on desktop.
Weird.
Think the users will have to move the focus themselves !!
Cheers
Simon
-
Hi Simon,
Please read the ticket responses.
The setfocus() issue has been fixed in the next build as I already mentioned on the ticket.