Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Setfocus issue

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    369

    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("pageagecustomer?action=add"); WORKS

    Lianja.showDocument("pageagecustomer"); 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
    Last edited by SpringBox; 2019-09-13 at 14:31.

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    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.

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    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.
    Last edited by barrymavin; 2019-09-14 at 03:44.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    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

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    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")

    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    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.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    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
    Last edited by SpringBox; 2019-09-20 at 03:32.

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    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

  9. #9
    Senior Member
    Join Date
    Jan 2014
    Posts
    369
    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

  10. #10
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Simon,

    Please read the ticket responses.

    The setfocus() issue has been fixed in the next build as I already mentioned on the ticket.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us