Jump to content

roberto68

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by roberto68

  1. so I changed $("#dropdowns").change(function() { for (every DD has that class) $(".dropdown-menu").change(function() { so it targets every DD but the buttons stays disabled all the time. And my last point - why are the dropdowns rolled out on page load - I want them to be hidden and show only on the click - which it does right now but on the page load it is "rolled out" not hidden as I excpect it to be right now it is like that // $("select").removeClass("dropdown-menu"); $('.dropdown-toggle').click(function(){ $('.dropdown-menu').toggle(); }); when I uncoment the 1st line DD are hidden onload but then they are not working anymore
  2. and here's html : just hte 1st dropwdown but it goes on like that <form name="dropdowns" id="dropdowns"> <div class="box"> <img src="images/pic1.jpg" alt="pic1"> <h2>education</h2> <label for='educationForm'>select what you wanna learn<br><div align="center" class="drop"> <a href="#" class="dropdown-toggle">select</a><select class="dropdown-menu" multiple="multiple" name="mydropdown1[]" id="dd1"><label="education"><option value="1">IT-programing</option><option value="2">IT-sys_admin</option><option value="3">IT</option><option value="4">science</option><option value="5">electronic engineering</option><option value="6">math&physics</option><option value="7">mechanical_engineering</option></select></label></div></label>
  3. I've form where htere are 4 multiselect dropdowns I use code like this ("dropdowns" is the id of that form) and there's nothing else in that form just those multiselects. $(".submit").attr('disabled','disabled'); // defaultne disabled $("#dropdowns").change(function() { // alebo cekovat kazdy dd zvlast if($(this).val()===""){ $(".submit").removeAttr('disabled'); } else { $(".submit").attr('disabled','disabled'); } }); maybe should I chcek all 4 DDs inside the .change(function ??? instead of if =($this) for (i=1; i<4; i++) { if($("#dd"+i).val()===""){ .... the ids are dd1....dd4. amd one littel question - I've seen somwhere .fliter(:selected) or smth like that - cause I've little probelms with this form retrieving on another page - so I'd like to post it one form - so when user clicks submit another multiselect = another form is created at that time actualy that newly created is posted
  4. I've 4 dropdowns (multiple select) - when value of any changes = user selects -> append that option to <ul>, if deselect => remove that option from <ul> that dropdowns are in 1 form so right now I've smth like this - I know it is not all OK $(".submit").attr('disabled','disabled'); // $("#dropdowns").change(function() { if($(this).val()===""){ $(".submit").removeAttr('disabled'); } else { $(".submit").attr('disabled','disabled'); }for (i=1; i<4; i++) { $('#"dd"+i option').each(function() { //check if smth is selected in each dd if($(this).is(':selected') { var sel = $(this).(':selected').val(); if( $('ul').has("li").val() == sel){ // if there is an li with that value } else{ $('<li>').text(sel).prependTo('.categories'); // <ul> called categories } } }); } });
  5. https://railsforum.com/topic/60691-could-not-locate-gemfile-or-bundle-directory-but-i-did-cd-my-project/
  6. but the probelm is with that from retrieving on another page - cause the form consist of 4 multiple select dropdowns. yeah but now i have an idea i retireve it like this var DD1 = <?php echo json_encode($_GET["mydropdown1"]) ?>; var DD2 = <?php echo json_encode($_GET["mydropdown2"]) ?>; .... and then I can concatenate those 4 fields into one, is it a good idea?
  7. ok so now I've corrected it - to explain it better : currently I've one multiselect Dropdown with devided by optgroup tags, but I've have template where there are 4 ( 3 are blank cause that's the problem how to post 4 dropdowns in 1 form) but that 1 Dropdown is working well right now - but I want 4 and optionaly show user what they've selected in some extra DD which'll be blank on document.ready
  8. I have 4 multuiple select elemts - Dropdown lists. When user selects an option I want that option appear in blank DD (or some textbox...) . If it's to complicated meaybe it'll be enough just to detect taht values selected in those dropdowns on button click. Here's my html <form name="dropdowns" id="dropdowns"><label for='educationForm'>select what you wanna learn<br><div align="center"><select multiple="multiple" name="mydropdown1[]" id="dd1"><option value="1">IT-programing</option><option value="2">IT-sys_admin</option><option value="3">IT</option><option value="4">science</option><option value="5">electronic engineering</option><option value="6">math&physics</option><option value="7">mechanical_engineering</option></select></div></label><label for='sportFrom'>move urself up!<br><div align="center"><select multiple="multiple" name="mydropdown2[]" id="dd2"><option value="8"></option><option value="9"></option><option value="10"></option><option value="11"></option><option value="12"></option><option value="13"></option>....... what should I do - chcek every of the dropdown to change and if changed get value /text of that option and append it to that "newly" created dropdown?
  9. I've find this on Stackoverflow - and it works fine $('#submit').attr('disabled', true);$('.required').keyup(function () { var disable = false; $('.required').each(function(){ //type hidden exclude if($(this).val()==""){ //notifikovat ze nefunguje GPS - adresa disable = true; } }); // tato funckia check text filedy ci su filled $('#submit').prop('disabled', disable); });
  10. https://developers.google.com/maps/documentation/javascript/events#EventArguments and yeah I read the intro at the top of that page dbclick is valid event
  11. function Person (name, age) { this.name = name; this.age = age;this.printMe = new function(){ return console.log("name" + Person.name + "age" + Person.age); };}// Now we can make an array of peoplevar family = new Array();family[0] = new Person("alice", 40);family[1] = new Person("bob", 42);family[2] = new Person("michelle", 8);family[3] = new Person("timmy", 6);// add the last family member, "timmy", who is 6 years oldfor (i=0; i < family.length; i++){ family[i].printMe; } It's simple I wanna print name and age but this way it isn't working
  12. no I do not have any error, when I doubleclick it only zooms in, I put alert box right after placeMarker but no alert appears , ok so i change dbclick to click and it works
  13. my approach is simple want a prompt box apper on doubleclick on google maps : user clicks yes (some form is rendered, another page - for now alert box appears) if no nothing.. but my code doesn't do teh work google.maps.event.addListener(map, 'dbclick', function(event) {placeMarker(event.latLng,"addEvents.html"); }); function placeMarker(location, page) {// render pop up box, to add event or cancel if (confirm("Press a button!") == true) { alert ("You pressed OK!"); // render pop up form //window.location.replace(page); // podla toho ci event or place var marker = new google.maps.Marker({ position: location, map: map }); map.setCenter(location); } else { alert ("cancel adding event"); // chcem pridat event } } the listener is placed inside this function (it finds wether geolocation is OK and if so it centers to the current postiion if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { I also add alert box inside this function - the alert box appears without problems
  14. for everyone else here's the answer http://stackoverflow.com/questions/28408357/disable-form-button-unless-all-text-input-fields-are-filled-in
  15. I've form consisting of multiple fileds and I need to disable sumit button unless user fill smth in those fileds ( all of the requiered ones). I've smth like this $(document).ready(function() { $("#submit").attr('disabled', 'disabled'); $("#eventName").keyup(function(){ // treba prerobit if($(this).val() != '') { $("#myText").keyup(function(){ if($(this).val() != '') {if (document.getElementById("start").value() !=""){ // mozno tiez (function){ but this is not dong the work. wouldn't be smth like while(1) and chcek if every filed is filled ( .val() !='') - wtih some timer ?
  16. I've form consisting of multiple fileds and I need to disable sumit button unless user fill smth in those fileds. I've smth like this $(document).ready(function() { $("#submit").attr('disabled', 'disabled'); $("#eventName").keyup(function(){ // treba prerobit if($(this).val() != '') { $("#myText").keyup(function(){ if($(this).val() != '') {if (document.getElementById("start").value() !=""){ // mozno tiez (function){ but this is not dong the work. wouldn't be smth like while(1) and chcek if every filed is filled - wtih some timer ?
  17. I want to disable buttons when user do not choose category ind dropdown list - it works but only for one id the other ids with the same "name" are still enabled here's my code $(document).ready(function() { // Create the dropdown base $("<select />").appendTo("nav"); $("#submit").attr('disabled','disabled'); // defaultne disabled $("#dropdowns").change(function() { // or keyup(function) if($(this).val()===""){ $("#submit").removeAttr('disabled'); } else { $("#submit").attr('disabled','disabled'); } }); ..... <div class="mapbuttons" id="mapbuttons" > <input type="button" value="add a place" id="submit" onclick="proceed('addplace')" /> <input type="button" value="add an event" id="submit" onclick="proceed('addevent')" /> <input type="button" value="show event" id="submit" onclick="proceed('showevent')" /> </div>
  18. but I neeed to pass it to javascript so can I do it like this ? so i'll have it in javascript array var categories =<?php echo htmlspecialchars($_GET["mydropdown1"]) ?>;
  19. ok so in php I automatically get only those number 2,3.. in that array?
  20. the URL is still the same though, I need only those category numbers so how would it look like ? my full url is http://localhost/map.php?mydropdown1=2&mydropdown1=3 and I need only those numbers 2,3 ... so how woudl completer code look like funtion getULRvars(){$url = _POST['mydropdown1'];$myArray1 = explode('&', $url);$myArray2 = explode('=', $myArray1); and $params'd be thing I want ?? or rahter do it with that JS funciton I posted ?
  21. <form name="dropdowns" id="dropdowns"><label for='educationForm'>select what you wanna learn<br><div align="center"><select multiple="multiple" name="mydropdown1" id="dd1"><optgroup label="education"><option value="1">IT-programing</option><option value="2">IT-sys_admin</option><option value="3">IT</option><option value="4">science</option><option value="5">electronic engineering</option><option value="6">math&physics</option><option value="7">mechanical_engineering</option></optgroup>......</select></label></form> ok so here's my html
  22. I have multiple select (Drop down list) - I select options from that DD list and post that to another page. Now my url link looks like that http://localhost/map.php?mydropdown1=1&mydropdown1=2 and I want my Url link look like that (javascript, php) it is easier to parse http://localhost/map.php?mydropdown1=1,2 I select categories in that DDlist and on the other page (map.php) smth is performed (javascript) according to selected categories. I've function like this to retrieve url variables on map.html (it's working fine) function getUrlVars() { // get category id = number from the form(DDlsit) var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars;}
  23. oh my bad it was so simple so here's my code , for everyone having same problem switch(mapType) { case "showevent" : $("#dropdowns").attr("action", "showEvents.html"); $("#dropdowns").submit(); break; case "addplace" : $("#dropdowns").attr("action", "addPlace.html"); $("#dropdowns").submit(); break;case "addevent" : $("#dropdowns").attr("action","map.html"); $("#dropdowns").submit(); break; }} <div class="mapbuttons" id="mapbuttons" > <input type="button" value="add a place" id="addplace" onclick="proceed('addplace')" /> <input type="button" value="add an event" id="addevent" onclick="proceed('addevent')" /> <input type="button" value="show event" id="showevent" onclick="proceed('showevent')" /> </div>
  24. ok so I changed the html put it to 1 dropdown with optgroup. so here's my html <div class="box"> <img src="images/pic1.jpg" alt="pic1"> <h2>education</h2><form name="dropdowns" id="dropdowns"><label for='educationForm'>select what you wanna learn<br><div align="center"><label for="education" id="dd1"><select multiple="multiple" name="mydropdown1" id="dd1"><optgroup label="education"<option value="1">IT-programing</option><option value="2">IT-sys_adm-proin</option><option value="3">IT</option><option value="4">science</option><option value="5">electronic engineering</option><option value="6">math&physics</option><option value="7">mechanical_engineering</option></optgroup>...........<optgroup label="volunteer"<option value="23"></option><option value="24"></option><option value="25"></option><option value="26"></optio</label><option value="27"></option><option value="28"></option><option value="29"></option></optgroup></select></label></form></div></label> and the javascript remained unchanged
  25. so I quoted it, but hte result is still the same, is it ok that the form consists of multiple dropdowns and I want to submit it at once ? or simply here's my html for dropdowns. There's no error in javascript console <form name="dropdowns" id="dropdowns"> <div class="box"> <img src="images/pic1.jpg" alt="pic1"> <h2>education</h2><label for='educationForm'>select what you wanna learn<br><div align="center"><label for="education" id="dd1"><select multiple="multiple" name="mydropdown" id="dd1"><option value="1">IT-programing</option><option value="2">IT-sys_adm-proin</option><option value="3">IT</option><option value="4">science</option><option value="5">electronic engineering</option><option value="6">math&physics</option><option value="7">mechanical_engineering</option></select></label></div></label> ......the other 3 dropdowns</form>
×
×
  • Create New...