Appgini 5.30 Dropdown List Empty

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
wolkenlos
Posts: 7
Joined: 2014-11-23 16:26

Appgini 5.30 Dropdown List Empty

Post by wolkenlos » 2014-11-23 16:43

Hi!
I have some problems with the function "Drop-down list". I made a table with 2 values. In the website view the dropdown list is empty. Please take a look at my picture. How to set the first value of the list as default.

regards
wolkenlos
Attachments
d3.jpg
d3.jpg (178.42 KiB) Viewed 6634 times

udayvatturi
AppGini Super Hero
AppGini Super Hero
Posts: 85
Joined: 2014-06-14 03:08
Location: India
Contact:

Re: Appgini 5.30 Dropdown List Empty

Post by udayvatturi » 2014-11-23 17:12

Hi,
You can use magic hooks and select the default value you want.
Magic Hooks is a javascript file with name same as tablename-dv.js

You select default value, you can use the following code

Newer versions of AppGini (5.20 and above)

Code: Select all

$("#e8").select2("val", "CA");
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:

Code: Select all

jQuery("#fieldname-container").select2("val", "new-value");

wolkenlos
Posts: 7
Joined: 2014-11-23 16:26

Re: Appgini 5.30 Dropdown List Empty

Post by wolkenlos » 2014-11-23 17:32

Hi!
Thx for the answer.
I am sorry i am not a coder :-)
where have I put this file: tablename-dv.js (path) - name of my tablename or exactly "tablename-dv.js"
my 2 values are: FEM;;DIN
what have I to code into the file to have a dropdown list with the default value "FEM" first"

I have more dropdownlists.... how to fix it?
also working with: tablename-dv.js

THX A LOT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

greets
wolkenlos

udayvatturi
AppGini Super Hero
AppGini Super Hero
Posts: 85
Joined: 2014-06-14 03:08
Location: India
Contact:

Re: Appgini 5.30 Dropdown List Empty

Post by udayvatturi » 2014-11-23 17:38

You are welcome
Please go through this
http://bigprof.com/appgini/help/advance ... agic-files

And coming to

Code: Select all

jQuery("#fieldname-container").select2("val", "new-value");
You need to page and go to inspect element for the dropdown and you find id="XXXX-container"
so you will replace fieldname-continer with xxxx-container
and new-value with "FEM"

wolkenlos
Posts: 7
Joined: 2014-11-23 16:26

Re: Appgini 5.30 Dropdown List Empty

Post by wolkenlos » 2014-11-23 18:18

hi udayvatturi!

a little bit more help please :-)

for example I made a new database with 2 tables
1 textfield
1 dropdown

Tablename: table1
Name of the dropdown: field3
2 Values: Peter;;Mary

Name of the conatiner (HTML view):
<div class="panel-body" id="table1_dv_container">

Code: Select all

<div class="row">
		<!-- form inputs -->
		<div class="col-md-8 col-lg-10" id="table1_dv_form">
			<fieldset class="form-horizontal">

				<div class="form-group">
					<label for="field2" class="control-label col-lg-3">Field 2</label>
					<div class="col-lg-9">
						<input tabindex="1" maxlength="40" type="text" class="form-control" name="field2" id="field2" value="" required>
					</div>
				</div>

				<div class="form-group">
					<label for="field3" class="control-label col-lg-3">field3</label>
					<div class="col-lg-9">
						<select tabindex="1" style="width: 100%;" name="field3" id="field3">
	<option value="">&nbsp;</option>
	<option value="Peter" >Peter</option>
	<option value="Mary" >Mary</option></select><script>jQuery(function(){ jQuery("#field3").select2({ minimumResultsForSearch: 15 }); })</script>
					</div>
				</div>

			</fieldset>
		</div>
now I made a file: table1-dv.js

Code: Select all

    $("#table1_dv_container").select2("val", "Peter");
	jQuery("#table1_dv_container").select2("val", "Peter");
I uploaded this file to: /hooks

but I am sorry it dont work.... no effect ;-)

greets
wolkenlos

Bertv
Veteran Member
Posts: 65
Joined: 2013-12-11 15:59

Re: Appgini 5.30 Dropdown List Empty

Post by Bertv » 2014-11-23 21:33

Wolkenlos,
its much easier:
- fill the first value of the possible values into 'Default': FEM
and generate. That's all.
Bert
I am using Appgini 5.75

udayvatturi
AppGini Super Hero
AppGini Super Hero
Posts: 85
Joined: 2014-06-14 03:08
Location: India
Contact:

Re: Appgini 5.30 Dropdown List Empty

Post by udayvatturi » 2014-11-24 08:46

Yes, that a simple process, how did i missed it. :?:

wolkenlos
Posts: 7
Joined: 2014-11-23 16:26

Re: Appgini 5.30 Dropdown List Empty

Post by wolkenlos » 2014-11-24 16:54

Hallo Bertv and Udayvatturi!

Thank you very very much!
I changed the default value and BINGO it worked :-)

greets
wolkenlos

Post Reply