Keypress Set Focus on details add (v2023)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
tommysaputraz
User
Posts: 4

Keypress Set Focus on details add (v2023)

Post by tommysaputraz »

Hi...

Let say I had a details as below tabel

A | B | C | D |
E | F | G | H |

What I would like to achieved is when I add master detail, If I use "Enter" when cursor in "A" it will set focus to "E"
if I use "Enter" when cursor in "C" it will set focus to "G"

Is there anyway I can achieved this method?

So sorry for my bad explanation.

Thank you All


arbei
User
Posts: 9384

Post by arbei »

You may use Client Side Events to add your "keypress" event.


tommysaputraz
User
Posts: 4

Post by tommysaputraz »

How can I get the row and column index when hit "Enter"?


arbei
User
Posts: 9384

Post by arbei »

You may get info from the event "e" passed to your handler, use console.log(e) to see what you can use. If your code does not work, you may post for discussion.


tommysaputraz
User
Posts: 4

Post by tommysaputraz »

I use PHPmaker V2023 and I put the code in client script - Add

First, Just want to show the alert after enter keypress (just to make sure the correct event)

{ // keys = event types, values = handler functions
    "change keyup keypress", function(e) {
        var myKey = e.which;
        if (myKey == 13) {
            ew.alert("Enter");
        }
    }
    }

But not working


arbei
User
Posts: 9384

Post by arbei »

tommysaputraz wrote:

I put the code in client script - Add

Wrong place, arbei wrote:

You may use Client Side Events to add your "keypress" event.

It is field setting.


tommysaputraz
User
Posts: 4

Post by tommysaputraz »

Thanks
Now the events was succeed thanks to you
But my problem now I cannot get the row index

I try with

{
keypress:function(e){
var myKey=e.which;if(myKey==13){
    row_index = $(this).parent().index();
    ew.alert(row_index)
}
}
}

But the result was empty


arbei
User
Posts: 9384

Post by arbei »

Note that .index() is not row index, and $(this).parent() is the element of the input, not the row, you need to use .closest("your selector") to find the row.


Post Reply