Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Adding itens inside a dropdownlist

Adding itens inside a dropdownlist 2 years 7 months ago #70657

  • jsmello
  • jsmello's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Hi,

I have a question, dropdownlist of cities with id = 160, and I want to put an array itens inside the dropdownlist dynamically, depending on the state selected before.

I am already getting the cities and putting them in array, but the problem is the dropdown list. The test code above insert the word "oi" in ALL items, but don't create a new item.
I'm not getting iterate correctly inside the dropdownlist.

$(options).append( new Option("oi",0) );

Thankz
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70665

  • Mazi
  • Mazi's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
Can you set up a demo survey and link it here so we can have a lok how it should look like?

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70668

  • jsmello
  • jsmello's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Is suficient an image?

Thanks,
Jefferson.




imagem_help.JPG
Last Edit: 2 years 7 months ago by jsmello.
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70672

  • Mazi
  • Mazi's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
We need to have a lok at the HTML page source code so an image doesn't help much, sorry.

You can use our online demo at demo.limesurvey.org/adminfor a temporary demo link:
Username: admin
Password: test

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70675

  • jsmello
  • jsmello's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Mazi wrote:
We need to have a lok at the HTML page source code so an image doesn't help much, sorry.

You can use our online demo at demo.limesurvey.org/adminfor a temporary demo link:
Username: admin
Password: test

I think that the javascript support is not enabled.
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70679

  • Mazi
  • Mazi's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
You can change that at the global settings -> security

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70680

  • jsmello
  • jsmello's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Mazi wrote:
You can change that at the global settings -> security

There is this msg:

Note: Demo mode is activated. Marked (*) settings can't be changed.
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70686

  • Mazi
  • Mazi's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
Damn, then you have to link to another Limesurvey system out there in the web. Have a look at www.LimeService.com for example.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70734

  • jsmello
  • jsmello's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Follow the example of survey.

jsmello.limequery.com/69688/lang-en

with this JS code:
<script type="text/javascript" charset="utf-8">
 
$(document).ready(function() {
 
 
      // In my survey I´m getting the cities of the .csv file comparing its state with the state selected in the dropdownlist state (it´s working) 
      // The problem is when I add a new item in the dropdownlist of the cities. I am not getting it. 
 
 
      var options = $('#question2 option');
 
      $(options).append( new Option("Hi, it is the problem",0) ); 
 
});
 
</script>
 
The administrator has disabled public write access.

Re: Adding itens inside a dropdownlist 2 years 7 months ago #70741

  • DenisChenu
  • DenisChenu's Avatar
  • NOW ONLINE
  • Moderator Lime
  • Posts: 6238
  • Thank you received: 794
  • Karma: 238
Hello and with:
var options = $('#question2 select');

Here, you append an option to an option. (api.jquery.com/append/ )
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.255 seconds
Donation Image