- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
PostCode lookup to area
- casfan
- Topic Author
- Offline
- New Member
Less
More
10 years 9 months ago #96841
by casfan
PostCode lookup to area was created by casfan
Ok So I have a question at the beginning of a survey that asked for the user to input a full postcode (zipcode) now I have a spreadsheet with all the possible postcodes on for this survey which and there associated areas.
To get the area accurately you need all 7 characters of the postcode. So in my spreadsheet I have 2995 entries or 2995 postcodes and in the column next to it the area there are 11 areas in total.
Now we are not allowed to see the postcode on the exported survey only the Area. So I cant do a find and replace in Excell afterwards.
So is there a way to do this in the program?
My first thoughts were a select box where they select the postcode and the value entered is the area. However this is going to be a massive select box and not pretty at all.
Is there a way around this?
Thanks In Advance
To get the area accurately you need all 7 characters of the postcode. So in my spreadsheet I have 2995 entries or 2995 postcodes and in the column next to it the area there are 11 areas in total.
Now we are not allowed to see the postcode on the exported survey only the Area. So I cant do a find and replace in Excell afterwards.
So is there a way to do this in the program?
My first thoughts were a select box where they select the postcode and the value entered is the area. However this is going to be a massive select box and not pretty at all.
Is there a way around this?
Thanks In Advance
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
10 years 9 months ago #96849
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic PostCode lookup to area
Hello,
Best is to use autocomplete with a csv file (or a DB) manual.limesurvey.org/Workarounds:_Manip...wers_for_text_inputs
Denis
Best is to use autocomplete with a csv file (or a DB) manual.limesurvey.org/Workarounds:_Manip...wers_for_text_inputs
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: casfan
The topic has been locked.
- casfan
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 years 9 months ago #96872
by casfan
Replied by casfan on topic PostCode lookup to area
OK I have made some jquery stuff
so var pcArray = [];
pcArray = "Main area";
pcArray = "Main area";
pcArray = "Suburban Area";
<input type="text" id="pc" name="pc" />
$("#pc").on("change", function(){
if(pcArray[$(this).val()] !== undefined) {
$("#pc").val(pcArray[$(this).val()]);
}
});
What I cant do is insert this into my survey.
I'm guessing that I can change #pc to the #questionADD1 where (ADD1) is the question code.
I have added <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> into the head of the startpage.
But when I go to the question click on source and then paste
<script type="text/javascript" charset="utf-8">
var pcArray = [];
pcArray = "Main area";
pcArray = "Main area";
pcArray = "Suburban Area";
$("#pc").on("change", function () {
if (pcArray[$(this).val()] !== undefined) {
$("#pc").val(pcArray[$(this).val()]);
} else {
$("#pc").val("other");
}
});
</script>
I dont even get a error just all the code appears then when i go in and edit the question source it has changed to
<sc<x>ript type="text/javascript" charset="utf-8" ??
What am i doing wrong
This works with jquery1.9.1
so var pcArray = [];
pcArray = "Main area";
pcArray = "Main area";
pcArray = "Suburban Area";
<input type="text" id="pc" name="pc" />
$("#pc").on("change", function(){
if(pcArray[$(this).val()] !== undefined) {
$("#pc").val(pcArray[$(this).val()]);
}
});
What I cant do is insert this into my survey.
I'm guessing that I can change #pc to the #questionADD1 where (ADD1) is the question code.
I have added <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> into the head of the startpage.
But when I go to the question click on source and then paste
<script type="text/javascript" charset="utf-8">
var pcArray = [];
pcArray = "Main area";
pcArray = "Main area";
pcArray = "Suburban Area";
$("#pc").on("change", function () {
if (pcArray[$(this).val()] !== undefined) {
$("#pc").val(pcArray[$(this).val()]);
} else {
$("#pc").val("other");
}
});
</script>
I dont even get a error just all the code appears then when i go in and edit the question source it has changed to
<sc<x>ript type="text/javascript" charset="utf-8" ??
What am i doing wrong
This works with jquery1.9.1
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10629
- Thank you received: 3696
10 years 9 months ago #96904
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic PostCode lookup to area
See - manual.limesurvey.org/Workarounds:_Manip....29_in_LimeSurvey.3FI dont even get a error just all the code appears then when i go in and edit the question source it has changed to
See this post for a solution that uses autocomplete and jquery.csv to automatically fill fields - www.limesurvey.org/en/forum/design-issue...s-csv?start=10#91704Now we are not allowed to see the postcode on the exported survey only the Area. So I cant do a find and replace in Excell afterwards.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.