For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 6 replies, 5 voices, and was last updated 12 years, 11 months ago by
jjcous.
-
AuthorPosts
-
careldegoedeMemberHi guys,
I am filling a comboxbox via a CSV file.
I have 2 comboxboxes.
Comboxbox 1 is my provinces (9 of them).
comboxbox 2 gets filled pending what is selected in comboxbox 1.This all is working GREAT. Except, i need to clear the display text of comboxbox 2.
In other words, if comboxbox 2 displayed “JOHANNESBURG”, and i re selected a new Province (comboxbox 1);
my app does re fill comboxbox 2 with the new cities, but it is still displaying the last selected city “JOHANNESBURG”.
I would like it to be BLANK.I have tried millions of options via google, NONE working, please help,
Allternative option, if comboxbox 2 can display the first item in the newly filled items.function processData(allText) {
var allTextLines = allText.split(/\r\n|\n/);
var headers = allTextLines[0].split(‘,’);
var lines = [];var value = $(‘select[name=”combobox2″]’);
value.empty();
//Trying these variations to remove the displayed text in the combobox
value.val(”);
value.html(“”);for (var i=0; i<allTextLines.length; i++) {
var x=1;
var data = allTextLines[i].split(‘,’);if (data[0] == ProvSelected){
value.append(new Option(data [1],data [1]));
}}
//Trying these variations to remove the displayed text in the combobox
value.val(0).change();
value.clear;// die opsie dit die check daar, maar display nie as text nie // value[0].selectedIndex = 0;
phoneui.alert(‘done’);
}
April 11, 2013 at 4:13 pm #337901
nvtsMemberYou need to add this line to clear in MobiOne.
$(‘#m1-screenname-combobox’).val (”);
Change to your app screen name and box name.
Cheers…
April 12, 2013 at 1:10 pm #337962
careldegoedeMemberThanks for the reply.
Much appreciated, however it is not working.
The “CITY” does not blank out when i select a new “PROVINCE”.Any other ideas?
Very weird that something so simple is being such a pain in the … 🙂
Can i mail u my app and have a loo at my sample?
regards
Carel
April 13, 2013 at 2:19 am #337980
Stu WadeMemberHave you tried forcing a screen refresh, something like this. I may have the syntax a little screwed, but I’m new to JavaScript and am posting from memory …
$(‘select[name=”combo”] option:first’).attr(”selected’,’selected’);
phoneui.preprocessorDOM(‘#m1-page’);Hope this helps.
April 13, 2013 at 8:06 am #337987
BrandonMemberThis will blank out the combobox2 text, make sure you update it with your screen name on the preprocessDOM
$(‘select[name=”combobox2″] :selected’).text(”)
phoneui.preprocessDOM(‘#m1-screenname’); //force UI to updateApril 14, 2013 at 3:17 am #337999
careldegoedeMemberThanks guys,
Got it to work with your help.
Almost got disponded.
The only thing that got me stuck was the phoneui.preprocessDOM.
I kept trying the PAGE and MULTIPAGE…
But the last reply made me replace it with the project name, and whooooopi.
Now i can continue to my next page…lol.Once again, thanks you
function processData(allText) {
//phoneui.alert(‘done’);
var allTextLines = allText.split(/\r\n|\n/);
var headers = allTextLines[0].split(‘,’);
var lines = [];var value = $(‘select[name=”combobox1″]’);
value.empty();
$(‘select[name=”combobox1″] :selected’).text(”)for (var i=0; i<allTextLines.length; i++) {
var x=1;
var data = allTextLines[i].split(‘,’);if (data[0] == ProvSelected){
value.append(new Option(data [1],data [1]));
}}
$(‘select[name=”combobox1″] option:first’).attr(‘selected’,’selected’);
phoneui.preprocessDOM(“#m1-golfcoursefinder”);}
April 16, 2013 at 4:37 am #338083
jjcousMembercareldegoede,
is it possible to post your project?
Trying to fill comboboxes through .csv and give conditions to the comboboxes but can’t get it to work.Thanks
-
AuthorPosts
