Hello everyone,
We use a little javascript code to automatically complete a number a fields according to a field values.
This code is located in the tablename-dv.js file and is triggered when a button is clicked. It looks like:
form.elements['some input field''].value='default value';
...
...
The issue is that since a AppGini upgrade (probably 5.0, but I'm unsure of this), this automatic way of filling forms does not work anymore.
More precisely, it is still working for simple text input, but not anymore for the lists. (<select>).
If anyone can help...
Thank you,
Philippe
autofill with javascript
-
- AppGini Super Hero
- Posts: 85
- Joined: 2014-06-14 03:08
- Location: India
- Contact:
Re: autofill with javascript
Hi,
I did bit research and i observed few things. May be that will help you..
When i didnt select any values in the drop down the html content is like this
Following is the HTML code when i selected an item
There is change in line 3. So may be you can just try changing the value of that particular node.
That may help. I am not sure if this works.
I did bit research and i observed few things. May be that will help you..
When i didnt select any values in the drop down the html content is like this
Code: Select all
<div class="select2-container" id="s2id_ClientName-container" style="width: 100%;">
<a href="javascript:void(0)" onclick="return false;" class="select2-choice" tabindex="-1">
<span class="select2-chosen"><None></span>
<abbr class="select2-search-choice-close"></abbr>
<span class="select2-arrow"><b></b></span></a>
<input class="select2-focusser select2-offscreen" type="text" id="s2id_autogen4">
</div>
Code: Select all
<div class="select2-container" id="s2id_ClientName-container" style="width: 100%;">
<a href="javascript:void(0)" onclick="return false;" class="select2-choice" tabindex="-1">
<span class="select2-chosen">Uday Vatturi</span>
<abbr class="select2-search-choice-close"></abbr>
<span class="select2-arrow"><b></b></span></a>
<input class="select2-focusser select2-offscreen" type="text" id="s2id_autogen4">
</div>
That may help. I am not sure if this works.
-
- Posts: 3
- Joined: 2014-06-12 07:18
Re: autofill with javascript
Hello,
Intensive use of Google lead me to the answer. For those having a similar issue, simply note this: for the javascript part, appgini has moved from Prototype to another framework named Jquery.
A good explanation and quick howto can be find here:
http://gneady.com/category/javascript/
guess who is the author
Intensive use of Google lead me to the answer. For those having a similar issue, simply note this: for the javascript part, appgini has moved from Prototype to another framework named Jquery.
A good explanation and quick howto can be find here:
http://gneady.com/category/javascript/
guess who is the author
Re: autofill with javascript
Good dig, Philippe!
Newer versions of AppGini (5.20 and above) use a third-party component for drop-downs called select2. See: http://ivaynberg.github.io/select2/
From the above link, to change the value of a drop-down:
where e8 is the ID of the container of the drop down (for AppGini apps, the ID is fieldname-container, where fieldname is the name of the drop-down field), "CA" is the new value. So, the code should be:
Note that we are using jQuery rather than $ in the above code to avoid conflicts with Prototype framework as both jQuery and Prototype are used (we plan to remove Prototype gradually in future releases).
Newer versions of AppGini (5.20 and above) use a third-party component for drop-downs called select2. See: http://ivaynberg.github.io/select2/
From the above link, to change the value of a drop-down:
Code: Select all
$("#e8").select2("val", "CA");
Code: Select all
jQuery("#fieldname-container").select2("val", "new-value");
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.