This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile


Set focus on text field on custom page

Posted by johan 
Set focus on text field on custom page
April 10, 2019 01:49AM
Hi Eugineo

How can i set the focus on a textfield @ a custom page, so the cursor is blinking in the textfield.

I would like to use it for an barcodehandscanner.
And everytime I run the script I would like to go back to the textfield.

i'll wait for your answer.

regards Johan

I tried:

<script type="text/javascript" language="JavaScript">

but I'am not shure where to put this code


You are using DaDaBIK version 9.2.1-Monterosso enterprise,

PHP Version: 7.0.10

mysql version: 5.7.14

Web server: Apache/2.4.23 (Win64) PHP/7.0.10

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Re: Set focus on text field on custom page
April 10, 2019 06:57AM
Hello Johan,
if you are producing a custom PHP page, you can write your code as you want (respecting the rules about variable naming and so on).

If you have custom javascript code, you have to add it to the include/custom_functions.js file; you probably have to check with an IF statement if you are in your custom page (you can see that from the URL) otherwise the code will be executed in any page of your DaDaBIK app.


Eugenio |\.-./| DaDaBIK developer and project admin
Re: Set focus on text field on custom page
April 11, 2019 04:50AM
Tank you for your answer, I have found an easy way to set the focus.

<input type="text" name="fname" autofocus>

just add autofocus in de element does the work.
Sorry, only registered users may post in this forum.

Click here to login