Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Set Focus on Search Box for ARI JDataTables
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Set Focus on Search Box for ARI JDataTables
#25830
Set Focus on Search Box for ARI JDataTables 12 Years, 2 Months ago Karma: 0
Is there a way to automatically set the focus on the search box so that the cursor is in the search text box when the page loads. What path and file do I modify to add the code, and what code needs to be added.

This is an example of some of the code that I would expect to need.

<script type="text/javascript" language="JavaScript">
document.forms['searchbox'].elements['searchword'].focus();
</script>
The administrator has disabled public write access.
 
#25846
Re:Set Focus on Search Box for ARI JDataTables 12 Years, 2 Months ago Karma: 748
Hello,

Could you provide a link to a page where we can see a table?

Regards,
ARI Soft
The administrator has disabled public write access.
 
#25859
Re:Set Focus on Search Box for ARI JDataTables 12 Years, 2 Months ago Karma: 0
I have this fixed now. Here's how you can have any page with a arijdatatable search textbox be set to focus. I'm sure it's not the best way, but it's what it works.

This code grabs the GET variable that shows what article you are viewing. It then checks to see if it matches the one with your table. It then sets the focus to whatever textbox field that you want. eq(0) means the first textbox on the page eq(1) means the second etc.


1. In Joomla turn off "Search Engine Friendly URLs" for a moment so we can see the GET variables that it's using. (Site > Glocal Configuration > Site)
2. Visit the page that your table is on. Look at the URL, you should see at the end that it says "Itemid=". You will be referencing that page by that Itemid number. Put that number in the code below where it says '168'.
3. Download the latest jQuery code from their website and save it to your webroot directory with whatever name you want. In this example I'm calling it jquery.js
4. Edit your index.php file in your web root (/var/www/<sitename>/index.php). Go to the bottom of the page and paste this php/jQuery code in.

Code:


<?php
$GetPageIdCustomMod = $_GET["Itemid"];
if($GetPageIdCustomMod == '168')
{
echo"<script type=\"text/javascript\" src=\"jquery.js\"></script>
 <script type=\"text/javascript\">
   $(function() {
   $(\":input:visible:enabled:eq(1)\").focus();
   });
 </script>";
}
?>

The administrator has disabled public write access.
 
Go to topPage: 1