Jump to content

Auto Focus After Ajax Refresh

Recommended Posts

Hi, I have a search DataPage and when I bulk edit my records. I want to be automatically focus on the first text box of my bulk edit window

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {

I have the code above, but it is not working please help.

Link to comment
Share on other sites

Hello @Eruel,


I have developed a solution that does that.


Paste the script below in the footer of "Configure Fields for Bulk Edit Section", then update elemId to the name of your table field.


var elemId = "gist";

  document.querySelector(`[action*="[@cbAppKey]"] [id^=BulkEdit${elemId}]`).focus();
}, 300)



You might be asking why I put the code in a synchronous function setTimout. This is because there is a Caspio function that overrides the element focus after the BulkEditForm. I can't pinpoint where so I just did the setTimeout hack.


Hope this helps.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...