Hello everybody,
I wonder if it is possible to land in the field that we want to edit instead of the first field of the record. That is, if we have a table with a record containing the fields: name, address, email, telephone, and then we want to edit the telephone field, when we click over that field, the program will take us to the detail view of the table and our cursor will land on the record we have just clicked.
Could it be possible?
Wilfredo
Landing in the right field when editing a record
Re: Landing in the right field when editing a record
Open the file "hooks/tablename-dv.js" in a text editor (where tablename is the name of the concerned table -- create that file in the hooks folder if it doesn't already exist), and add this code:
Assuming your field name is "phone".
Code: Select all
$j(function(){
$j('#phone').focus();
})
AppGini plugins to add more power to your apps:
- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
Re: Landing in the right field when editing a record
Hi Ahmad,
Thank you for the code. It works great, however I cannot make it work for 2 or more fields, only for one. Can you give me an example with 2 fields?
Thanks again.
Wilfredo
Thank you for the code. It works great, however I cannot make it work for 2 or more fields, only for one. Can you give me an example with 2 fields?
Thanks again.
Wilfredo
-
- AppGini Super Hero
- Posts: 54
- Joined: 2014-03-09 20:20
Re: Landing in the right field when editing a record
This technique will only work on a single field - it basically overrides the default setting -> first field in the form.
In order to work with multiple fields in Table view, you'd have to add an OnClick event to the tables fields that you wish to enable focus on.
You can do this by editing the table_templateDV.html and the table_dml.php
In the hooks/tablename-dv.js file you'd have to add a listener to see which field in your table had been clicked and then it'd change the focus() based upon this result.
In order to work with multiple fields in Table view, you'd have to add an OnClick event to the tables fields that you wish to enable focus on.
You can do this by editing the table_templateDV.html and the table_dml.php
In the hooks/tablename-dv.js file you'd have to add a listener to see which field in your table had been clicked and then it'd change the focus() based upon this result.
Re: Landing in the right field when editing a record
Thank you very much.
I will try to implement what you have said.
Wilfredo
I will try to implement what you have said.
Wilfredo