Jump to content

DBookatay

Members
  • Posts

    334
  • Joined

  • Last visited

Posts posted by DBookatay

  1. Show me your "real" html.

     

    Probably the first one. I don't know. What does it say if you alert() it?

     

     

     

    <div class="form">

    <form method="post" action="process2.php" autocomplete="off">

    <label for="name">Name</label>

    <input type="text" name="name" id="name" value="Brad Guy" />

    <label for="phone">Phone</label>

    <input type="text" name="phone" id="phone" value="2039942323" />

    <label for="email">Email</label>

    <input type="text" name="email" id="email" value="brad@illism.com" />

    <ul>

    <li>Design:</li>

    <li><label for="master_plan"><input type="checkbox" name="master_plan" id="master_plan" value="Master Plan" /> Master Plan</label></li>

    <li><label for="front_foundation"><input type="checkbox" name="front_foundation" id="front_foundation" value="Front Foundation" /> Front Foundation</label></li>

    <li><label for="backyard_plan"><input type="checkbox" name="backyard_plan" id="backyard_plan" value="Backyard Plan" /> Backyard Plan</label></li>

    <li><label for="specialty_garden"><input type="checkbox" name="specialty_garden" id="specialty_garden" value="Specialty Garden" /> Specialty Garden</label></li>

    </ul>

    <label for="newsletter"><input type="checkbox" name="newsletter" id="newsletter" value="x" checked="checked" /> Yes, I would like to be added to your newsletter list.</label>

    <label for="comments">Comments</label>

    <textarea name="comments" id="comments" rows="5" cols="40" />this is solely a test</textarea>

    <input type="submit" id="submit" value="Sign Up" />

    <div class="loading"></div>

    </form>

    </div>

  2. How did you get every OTHER form element's value? Did you try looking it up in the jQuery manual? It explicitly tells you how to do this.

     

    http://api.jquery.com/val/

     

    I looked at this page, and tried both of these and neither worked:

    var master_plan = $('input[name=masterplan]:checked').val();
    var master_plan = $('input:master_plan:checked').val();
    

     

    There are 24 checkboxes on my form, but am only trying on 1 for now, just till I see that it's working.

  3. I am attempting to create an ajax contact form that the results gets emailed to me. I found a form demo online and edited it to meet my criteria, except that there were no checkboxes in the demo, when I add checkboxes everything but those work.

     

    Can someone please guide me through this?

     

    Here is the html

    <div class="done">
    <strong>Thank you !</strong> We've received your questions and someone from our office will respond at our earliest convience.</p>
    <p>Check your email, we just sent you a coupon for 10% off your first purchase.</p>
    </div>
    
    <div class="form">
    <form method="post" action="process2.php" autocomplete="off">
    <label for="name">Name</label>
    <input type="text" name="name" id="name" />
    <label for="phone">Phone</label>
    <input type="text" name="phone" id="phone" />
    <label for="email">Email</label>
    <input type="text" name="email" id="email" />
    <ul>
    <li>Design:</li>
    <li><label for="master_plan"><input type="checkbox" name="service[]" id="master_plan" value="Master Plan" /> Master Plan</label></li>
    <li><label for="front_foundation"><input type="checkbox" name="service[]" id="front_foundation" value="Front Foundation" /> Front Foundation</label></li>
    <li><label for="backyard_plan"><input type="checkbox" name="service[]" id="backyard_plan" value="Backyard Plan" /> Backyard Plan</label></li>
    <li><label for="specialty_garden"><input type="checkbox" name="service[]" id="specialty_garden" value="Specialty Garden" /> Specialty Garden</label></li>
    </ul>
    <label for="newsletter"><input type="checkbox" name="newsletter" id="newsletter" value="x" checked="checked" /> Yes, I would like to be added to your newsletter list.</label>
    <label for="comments">Comments</label>
    <textarea name="comments" id="comments" rows="5" cols="40" /></textarea>
    <input type="submit" id="submit" value="Sign Up" />
    <div class="loading"></div>
    </form>
    </div>
    

     

    The java is

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    $('#submit').click(function () {
    var name = $('input[name=name]');
    var phone = $('input[name=phone]');
    var email = $('input[name=email]');
    var comments = $('textarea[name=comments]');
    if (name.val()=='') {
    name.addClass('hightlight');
    return false;
    } else name.removeClass('hightlight');
    if (email.val()=='') {
    email.addClass('hightlight');
    return false;
    } else email.removeClass('hightlight');
    var data =
    'name=' + name.val() +
    '&phone=' + phone.val() +
    '&email=' + email.val() +
    '&comments=' + encodeURIComponent(comments.val());
    $('.text').attr('disabled','true');
    $('.loading').show();
    $.ajax({
    url: "process2.php",
    type: "GET",
    data: data,
    cache: false,
    success: function (html) {
     if (html==1) {
     $('.form').fadeOut('slow');
     $('.done').fadeIn('slow');
     } else alert('Sorry, unexpected error. Please try again later.');
    }
    });
    return false;
    });
    });
    </script>
    

     

    And the php is

    $name = ($_GET['name']) ? $_GET['name'] : $_POST['name'];
    $phone = ($_GET['phone']) ?$_GET['phone'] : $_POST['phone'];
    $email = ($_GET['email']) ?$_GET['email'] : $_POST['email'];
    $mailing = ($_GET['newsletter']) ?$_GET['newsletter'] : $_POST['newsletter'];
    $comments = ($_GET['comments']) ?$_GET['comments'] : $_POST['comments'];
    
    
    if($phone) {$phone = '('.substr($phone, 0, 3).') '.substr($phone, 3, 3).'-'.substr($phone, 6, 4);} else {$phone = '(Not Entered)';}
    

     

    How do I add the checkbox values, ONLY if the box is checked?

    (I didn't add the email part, because all of that works except for the "services" part.)

     

    I'd like to have whatever services are checked to showup, seperated by a coma.

  4. For some reason this array keeps repeating the 1st line onto the 2nd line and the 1st and 2nd line onto the 3rd line, and so on and so on.

     

    unset ($grade); $grade = array();
    foreach ($row as $grade => $value) {
     if (substr($grade, 0,1)== "y") {
     if ($grade == "y1") {if ($value == "x") {$grades[] = "1";}}
     if ($grade == "y2") {if ($value == "x") {$grades[] = "2";}}
     if ($grade == "y3") {if ($value == "x") {$grades[] = "3";}}
     if ($grade == "y4") {if ($value == "x") {$grades[] = "4";}}
     if ($grade == "y5") {if ($value == "x") {$grades[] = "5";}}
     if ($grade == "y6") {if ($value == "x") {$grades[] = "6";}}
     if ($grade == "y7") {if ($value == "x") {$grades[] = "7";}}
    }
    }
    $grades_string = implode(", ", $grades);
    

     

    The dB rows are titled y1, y2 etc.

     

    I can show someone a link with the example of what I mean the error is if need be.

     

     

    Rewrote it, problem was it should of been unset ($grade); $grades = array();

    unset ($grade); $grades = array();
      foreach ($row as $grade => $value) {
      if (substr($grade, 0,1)== "y" && $value == "x") {
      if ($grade == "y1") {$grades[] = "1";}
      if ($grade == "y2") {$grades[] = "2";}
      if ($grade == "y3") {$grades[] = "3";}
      if ($grade == "y4") {$grades[] = "4";}
      if ($grade == "y5") {$grades[] = "5";}
      if ($grade == "y6") {$grades[] = "6";}
      if ($grade == "y7") {$grades[] = "7";}
      }
    }
    $grades_string = implode(", ", $grades);
    

  5. For some reason this array keeps repeating the 1st line onto the 2nd line and the 1st and 2nd line onto the 3rd line, and so on and so on.

     

    unset ($grade); $grade = array();
      foreach ($row as $grade => $value) {
      if (substr($grade, 0,1)== "y") {
      if ($grade == "y1") {if ($value == "x") {$grades[] = "1";}}
      if ($grade == "y2") {if ($value == "x") {$grades[] = "2";}}
      if ($grade == "y3") {if ($value == "x") {$grades[] = "3";}}
      if ($grade == "y4") {if ($value == "x") {$grades[] = "4";}}
      if ($grade == "y5") {if ($value == "x") {$grades[] = "5";}}
      if ($grade == "y6") {if ($value == "x") {$grades[] = "6";}}
      if ($grade == "y7") {if ($value == "x") {$grades[] = "7";}}
      }
    }
    $grades_string = implode(", ", $grades);
    

     

    The dB rows are titled y1, y2 etc.

     

    I can show someone a link with the example of what I mean the error is if need be.

  6. Can someone please assist me. I found this script online, but need to modify it to only show 8 random (non repetitive) images, and keep failing.

      $dir = 'Albums/Kids/S/';
      $file_display = array ('jpg', 'jpeg', 'png', 'gif');
      $dir_contents = scandir($dir);
      shuffle($dir_contents);
      foreach ($dir_contents as $file) {
      $file_type = strtolower(end(explode('.', $file)));
      if ($file !== '.' && $file !== '..' && in_array($file_type, $file_display) == true) {
    	 $thumbs .= '<img src="'.$dir.'/'.$file.'" alt="" />';
      }
      }
    

  7. We were in the process of redesigning our website: http:/www.carcityofdanbury.com and hired someone to write an image upload/resize script for us. All of our images get stored into a folder on our server titled "Inventory." The guy that I hired (who has since dropped off the face of the earth) was testing the script (which did work correctly) by uploading all of the files to a folder called "newInventory."

     

    Once the redesigned site was complete I renamed the newInventory folder to Inventory, went into all the upload files and changed the path to Inventory as well and thought I was all set... No dice! Now the script is not working and I do not know how to fix it...

     

    I cant add images to my site now, which is a BIG problem, since we average 30 new vehicles a week.

     

    Please let me know how much it would cost to have someone correctly fix the script.

  8. Crap... I solved it. There was an extra comma

    					onkeyup: false,
    				submitHandler: function(form) {
    					$.ajax({
    						url: "01/Resources/infoRequest.php",
    						type: "POST",
    						cache:false,
    						data: $("#infoForm").serialize(),
    						dataType: "json",
    						success: function(data) {
    							$("li.Error").hide();
    							$("#contact_form").html(\'<div id="message"></div>\');
    							$("#message").html("<h2>Info Request Submitted!</h2>")
    							.append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.test + " on our<br />'.$vehicle.' and will contact you shortly.</p>")
    							.hide()
    							.fadeIn(2500, function() {
    								$("#message").append("<p>Would you like to <a href=\"?cat=02&stock='.$stock.'\">prefill an application</a> now?</p>")
    							});
    						}
    					});
    				},

     

    The very last comma in the code had to be removed.

  9. Tried both suggestions and neither worked... On stackoverflow.com someone said: "The issue is with data.for and it sounds a bit like you (the person who wrote the code) are trying to access one of the reserved names. Even though data.for should be valid, IE doesn't like names which it thinks are special (class for example). data.class would cause a problem in IE, even though it's valid.

     

    Try to rename data.for to something else data._for for example. Make sure you update the 01/Resources/infoRequest.php PHP file to return the new value as well." so I changed data.for to data.test and it did solve the issue in IE8, but IE7 still screws up my jquery.

     

    Here is the entire code, anybody see anything wrong?

    <script language="javascript" type="text/javascript">
    $(document).ready(function() {
    
    // Tabs
    	$("#tabs").tabs();
    
    // Google map
    	$(\'#embed\').gmap3(
    		{action: \'addMarker\', lat:41.40372, lng:-73.45844, map:{center: true, zoom: 17, mapTypeId: google.maps.MapTypeId.ROADMAP}}
    	);
    
    // Pic popup
    	$("#viewPics").fancybox({
    		\'type\': \'iframe\', \'transitionIn\': \'fade\', \'transitionOut\': \'fade\', \'width\': 900, \'height\': 500, \'autoScale\': false, \'scrolling\': \'no\'
    	});
    
    // Form Validation
    	jQuery.validator.messages.required = "";
    	$("#infoForm").validate({
    
    		invalidHandler: function(e, validator) {
    			var errors = validator.numberOfInvalids();
    			if (errors) {
    				var message = errors == 1
    					? \'You missed 1 required field.\'
    					: \'You missed \' + errors + \' required fields\';
    				$("li.Error span").html(message);
    				$("li.Error").show();
    			} else {
    				$("li.Error").hide();
    			}
    		},
    
    		onkeyup: false,
    		submitHandler: function(form) {
    			$.ajax({
    				url: "01/Resources/infoRequest.php",
    				type: "POST",
    				cache:false,
    				data: $("#infoForm").serialize(),
    				dataType: "json",
    				success: function(data) {
    					$("li.Error").hide();
    					$("#contact_form").html(\'<div id="message"></div>\');
    					$("#message").html("<h2>Info Request Submitted!</h2>")
    					.append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.test + " on our<br />'.$vehicle.' and will contact you shortly.</p>")
    					.hide()
    					.fadeIn(2500, function() {
    						$("#message").append("<p>Would you like to <a href=\"?cat=02&stock='.$stock.'\">prefill an application</a> now?</p>")
    					});
    				}
    			});
    		},
    
    	});
    
    });
    </script>

  10. I am almost done with my sites rebuild and am now in the testing phase. While testing in IE7 and 8 i found out that becuase of  a json script I have my jquery scripts will not work properly, even though they do in all other browsers, including IE9.

     

    The page is: http://www.carcityofdanbury.com/New/?cat=01&do=View&stock=18481

     

    The script is the Info Request form, something in this line: ".append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.for + " on our<br />'.$vehicle.' and will contact you shortly.</p>")" is causing the jquery tabs to no longer work.

     

    I did the php and jquery coding, but hired someone to do the json, so I do not know how to fix this. Any ideas?

  11. Looking for someone to code my "Refine Your Search" vehicle form. The site is: http://www.carcityofdanbury.com/New/?cat=01&do=Search

    What I am looking for is very similar to this: http://www.danbury.mercedesdealer.com/used (Click on "AMG" or "4Matic" to see the filtering)

     

    When the page loads all the vehicles are displayed, then as users click check boxes the vehicle results are filtered down. I want this accomplished without the need to hit a submit button, and with the values stored into a cookie, that way if a vehicle's page is looked at, the results will still be there when they go back to the search page.

     

    I'm new at jQuery and Ajax and am having trouble getting this done, so in an effort to get the new site up am willing to pay for this option.

    We are a small company that is dealing with a struggling economy, co please keep that in mind when you post bids.

     

    I am looking to get this done asap, so PM me with cost and time frame.

     

     

  12. I am in the middle of a complete site redesign and am having some issues.

    I am self taught, working on my site after hours of my 9-5.

     

    What I am trying to do is update my sql search query based on users selections, primarly for options dealing with vehicles in our inventory. By default all vehicles are shown, and as a user unchecks items the results are instantly updated. This is a prime example of what I am looking for: http://www.danbury.mercedesdealer.com/new

     

    When you check AMG or Navigation it updates.

     

    I am trying to do this to my page: http://www.carcityofdanbury.com/New/?cat=01&do=Search&category=Foreign

     

    I have googled everything I can think of and am now stuck...

     

     

    Any help would be greatly apprechiated!

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.