PDA

View Full Version : Setfocus issue



SpringBox
2019-09-13, 14:12
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

HankFay
2019-09-13, 21:16
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.

barrymavin
2019-09-14, 02:47
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.

SpringBox
2019-09-19, 07:24
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.setfocus();
TypeError: Result of expression 'Lianja.get("pagecustomer.tabcustomer").txtname' [undefined] is not an object.

Anyone have any thoughts?

Thanks


Simon

barrymavin
2019-09-19, 08:00
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")

barrymavin
2019-09-19, 09:24
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.

SpringBox
2019-09-20, 03:21
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

HankFay
2019-09-20, 03:44
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

SpringBox
2019-09-20, 03:59
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

barrymavin
2019-09-20, 04:38
Hi Simon,

Please read the ticket responses.

The setfocus() issue has been fixed in the next build as I already mentioned on the ticket.

SpringBox
2019-09-20, 08:19
My apologies Barry - thought it had ben included in current RC

Simon

SpringBox
2019-09-21, 16:35
Hi Barry

5.0RC58 has solved the desktop setfocus() issue.

Thanks for all your help.

Simon