Check out the LimeSurvey source code on GitHub!

Adding itens inside a dropdownlist

More
5 years 2 months ago #70657 by jsmello
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

Please Log in to join the conversation.

More
5 years 2 months ago #70665 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago - 5 years 2 months ago #70668 by jsmello
Is suficient an image?

Thanks,
Jefferson.




Attachments:
Last Edit: 5 years 2 months ago by jsmello.

Please Log in to join the conversation.

More
5 years 2 months ago #70672 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago #70675 by jsmello

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.

Please Log in to join the conversation.

More
5 years 2 months ago #70679 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago #70680 by jsmello

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.

Please Log in to join the conversation.

More
5 years 2 months ago #70686 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 2 months ago #70734 by jsmello
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>
 

Please Log in to join the conversation.

More
5 years 2 months ago #70741 by DenisChenu
Hello and with:
var options = $('#question2 select');

Here, you append an option to an option. ( api.jquery.com/append/ )

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
5 years 2 months ago #70750 by jsmello
Thanksss

Please Log in to join the conversation.

More
5 years 2 months ago #70761 by DenisChenu

You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.

:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form