Jump to content

Search the Community

Showing results for tags 'jquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I have this code: checkbox : function(elem) { $(function() { var isChecked = elem.checked, $check = $(this).val(), $address = $('.'+ elem.id); $image = $('.imagenone'); if(isChecked) { $address.stop().fadeIn("slow").css("display","inline-block"); $image.stop().fadeOut("slow").css("display","none"); } else { $address.stop().fadeOut("slow"); } }); } I need check if id of "$address"(class) displayed, not display other div with same id. I have a "query" which lists all the "rows" of the table, each "row" has a sub-category and associated product, which in my case the sub-category is the class and id is the product. but for different sub-categories can have the same product, not wanting to give the same id / product appear in duplicate. the problem is that there are only checkboxes for sub-categories, where the purpose is to create a filter. where all products with this sub-category, choosing more than one sub-category to check the sub-category appear. In different sub-category may contain the same products, just wanting to appear only once, and not repeated, ie not appear divs with the same id (same product) in duplicate. Structure Product List - http://s30.postimg.org/p0j37jl01/coding.jpg ps: sorry my bad english !
  2. I made a chat program where you enter your name and then a message, and it posts it so everyone can see it. Let's say that a user is logged into Facebook, and he goes on to my chat, can I have the chat check the Facebook account that he is logged into for his name, and then auto fill his name in the name input box?
  3. I have a table called tb_app with fields 'id','aic','batchcode','name' example table value: '1','0001','1','james'. As you can see there are three textboxes(name)(aic)(batchode). I want to show the value of aic and batchcode in their correspoding textboxes after typing the specific name in the textbox(name). The problem is when you type james in the textbox(name) it shows '00011' in the (aic)textbox and (batchcode)textbox...i want it to be '0001' in aic and '1' in the batchcode if i type james which is stored value in the table. html code: <form method="post"> <input type="text" name="names" id="query" onblur="getvalues()"/> <input type="text" name="aic" id="aic"/> <input type="text" name="batchcode" id="batchcode" /> </form> script code: <script type="text/javascript"> function getvalues() { var selname = $("input[name=names]:text").val(); $.ajax({ url: "getuserdata.php", data: {"selname":selname}, type: 'post', success: function(output) { $("#aic").val(output); $("#batchcode").val(output); } }); } </script> getuserdata.php page: <?php include('include/connect.php'); $selname = $_POST['selname']; $query = "SELECT * FROM tb_app WHERE tb_app.name RLIKE '$selname'"; $result = mysql_query($query) or die(mysql_error()); while($rows = mysql_fetch_array($result)){ echo $rows['aic']; echo $rows['batchcode']; } ?>
  4. Hi there, My head is stuck at this moment. I've got a textfile with words. Each word starts at a new line. I want to let the user delete a word(line) from this textfile after a button click. I managed to add the "add word to the list" function, but now i want a delete button variant. There are four files. myscript.js, vulwoorden.txt, word_filter.php and delete.word.php. This is the code for myscript.js: //User can add word to wordfilter $("body").on("click", ".hide_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/set.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); //User can delete word from wordfilter $("body").on("click", ".delete_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/delete.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); This is the code for the word_filter page <?php $lines = file('./includes/vulwoorden.txt'); $i=1; echo '<table id="wordlist" class="table">'; foreach ($lines as $line_num) { echo '<tr>' . "<td>" . $line_num . '</td><td>'; echo '<a data-word="' . $line_num . '" class="btn-danger btn-sm delete_word">Verwijder woord</a></td></tr>'; $i++; echo '</table>'; ?> And this is the code for delete.word.php (this code is just a copy from the set.word.php, so this is code to add a word to the textfile. <?php $fn = "vulwoorden.txt"; $file = fopen($fn, "a+"); if(isset($_POST['word']) && trim($_POST['word']) != "" && !is_null($_POST['word'])) { $word = $_POST['word'] . "\r\n"; fwrite($file, $word); } ?> I know how to do it with a form, but i want to do it combined with Ajax, so the users won't have to refresh the page. Thanks in advance!!
  5. This is a general question, thus no script. I'm looking for hints as to what could cause the following: Is there any reason that javascript or jQuery include scripts could prevent radio button values from being sent to the server while all other values from selects and texts are correctly sent? When not using the javascript or jQuery includes the radio values are sent.
  6. i know i can just redirect it with jquery ,js - client side, or using php - server side, but what is the fastest way to do that when the page is loading? let say i have users from the us, uk, canada - English language, French, German, Chinese... now where is the best place to detect the ip of the country and then give the user the interface in his language? second question, if the user want to change the language with a language buttons like: English, French, German, Chinese... what is the fastest way to do that again without redirect the page to another page? client side, server side or both. i can track the ip, i can redirect the page in more than one way, but i'm looking for the fastest way and that why I'm asking this.
  7. Javascript timer not displaying correctly. It has always displayed properly , but today out of nowhere its just not working the hours and the minutes are not working but , the seconds are counting down. I am new to web development this is the CDN and the external ref to the countdown timer <script type="text/javascript" src= "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="countdown.jquery.js"></script> <!-- this is countdown timer script" <!--> <script src="script.js"></script> <!-- this is where countdown timer is refences and where i change the date" <!--> below is the <script src="countdown.jquery.js"> (function($){ $.fn.countdown = function(options){ var settings={'date':null}; if(options){ $.extend(settings,options); } this_sel= $(this); function count_exec(){ eventDate=Date.parse( settings['date']) / 1000; currentDate= Math.floor($.now()/1000); seconds=eventDate -currentDate; days = Math.floor(seconds / (60 * 60 * 24)); seconds -= days * 60 * 60 * 24; hours = Math.floor(seconds / (60 * 60)); seconds -= hours * 60 * 60; minutes = Math.floor(seconds/60); seconds -= minutes * 60; this_sel.find('.days').text(days); this_sel.find('.hours').text(hours); this_sel.find('.mins').text(hours); this_sel.find('.secs').text(seconds); } count_exec(); interval=setInterval(count_exec,1000); } }) (jQuery); this is the jquery file <script src="script.js"></script> $(document).ready(function(){ $('#countdown').countdown({date: '26 January 2014 10:00:00'}); });
  8. Hello! Second post here. I'm new to PHP and have an idea of what needs to be done, but im not sure the best way to impliment it. Basically im looking for direction on whether I should use JS, AJAX, Jquery, or something else. from browsing around im guessing its going to be a combination of AJAX and Jquery to get this accomplished. Please advise on the best method to acomplish this. Thanks =) The user needs to populate txtAddr and hit btnGen. The function will then confirm txtAddr is equal to a variable. If it is equal, populate other 2 text fields (txtKey & txtDest) with predefined variables. <form action="frmGen" method="post"> <input name="txtAddr" type="text"> <!-- User enters text here -- Confirm txtAddr.text = $VarAddr -- If True, continue. If False, display DIV message --> <input name="txtDest" type="text"> <!-- Text field is filled with value from server/SQL when btnGen is pressed--> <input name="txtKey" type="text"> <!-- Text field is filled with value from server/SQL when btnGen is pressed--> <input name="btnGen" type="button"> <!-- assuming txtAddr is True, display strings in 2 text fields above & store all values from 3 text boxes in SQL --> </form>
  9. Hello, I'm trying to make a sliding bar or how you would describe it. And as the topic says, not a imageslider, where it takes a couple seconds before it changes picture.... I tried to come up with something in Paint to describe what I mean... A rolling bar so to say. I searched the webz like a maniac but only found sliders for images and other random stuff that isn't what I need, so I would hope someone of you guys might know how to do this. I'll attach the image. Thanks in advanced, peace!
  10. I have never done any jQuery programming before, and I am having a hell of a time finding a tutorial to do what I would like. Maybe I am looking for the wrong thing? I have this scenario: I have a product that has two or more images. I have one div where the product image is displayed. What I would like to do is have a 'next' and 'previous' button that cycles through the product images. I would love to use a professional gallery with transitions etc, but the image sizes vary, and so the div size must be dynamic like the image sizes. I was thinking of simply changing the contents of a div to change images. Something like this: <div id="imagediv"><img src="1.jpg" /></div> --> *next* button is clicked --> jQuery updates the div so that its contents become: <div id="imagediv"><img src="2.jpg" /></div> Is this possible? If the image sizes are different, is this possible? Cheers.
  11. I'm not really sure were this belongs because I don't really know which part of my script is causing the problem. So I have screen printed my issue. I think screen printing and showing you guys what my problems are is a great idea rather then me trying to explain myself. Pictures show more than words. But anyways. My main problem is that I want to insert the data "privacy=everyone" into it's own separate column, but also take the "privacy" out and insert into the column with the data "everyone". This is what I got so far. This is my issue I have on a live page. I cropped everything out except the issue. Here is my PHP code. Here is my Jquery code. And here is my MySQL data. My ideal MySQL data would look something like this. If I forgot something, I'll edit this post. EDIT: I should also mention that some of the PHP codes are whiten out in case of coping. The status and category are suppose to be one, but I had whiten out the other codes so the category and status looks like they're not aligned, but they are in my real code.
  12. i am creating a timesheet in php , i need a logic to update the database , the working is as follows 1. accept employee_id and date , from date get week number , query database with this input as follows my database task3 contains and id , emp_id , p_name , time , taskdate mysql_query("SELECT p_name, SUM(IF(DAYOFWEEK(taskdate) = 2, `time`, 0)) AS `MO`, SUM(IF(DAYOFWEEK(taskdate) = 3, `time`, 0)) AS `TU`, SUM(IF(DAYOFWEEK(taskdate) = 4, `time`, 0)) AS `WE`, SUM(IF(DAYOFWEEK(taskdate) = 5, `time`, 0)) AS `TH`, SUM(IF(DAYOFWEEK(taskdate) = 6, `time`, 0)) AS `FR`, SUM(IF(DAYOFWEEK(taskdate) = 7, `time`, 0)) AS `SA`, SUM(IF(DAYOFWEEK(taskdate) = 1, `time`, 0)) AS `SU` FROM task3 WHERE e_id = '$r' AND WEEK(`taskdate`,-1) ='$week' GROUP BY p_name "); this is returned through ajax onto my page , and then i can change date and get the result ,(check the attachments) i want to update the textboxes , this is my issue , i need a logic to get left-mist coloumn project_name and top coloumn date . table is created in php , with textboxes and values set to those coming from database ,
  13. Hi, I dont know if this is a wrong category to post. I have a registration form in my website. I need a overlay popup after the sucessfull registration process. Can someone help me. Thanks in advance. Regards..
  14. when click on the add new button table , label , textboxes(html form) , all apear same as above...view in photo
  15. I'm building a trade site for virtual currencies like bitcoin and such. i need a bit of help as well as some general feedback on the site(be forwarned, it looks pretty crappy in non webkit browsers like firefox and ie. i probably should be developing for those browsers as well, but i feel like they are inferior and will be forgotten soon enough. this being said, here is the link to the site https://openex.pw testusers: test123 | 12345678 TraderBob | 12345678 test2 | password test5 | password help i need: Chat: I need a way to autoscroll the window down, but unfortunately i haven't been able to get it to work. code always seems to break. $(document).ready(function() { //load messages $('#messages').load('ajaxLOAD.php'); $('#ajaxPOST').submit(function() { $.post('ajaxPOST.php', $('#ajaxPOST').serialize(), function(data){ //clear the message field $('#message').val(''); //reload messages $('#messages').delay(1000).load('ajaxLOAD.php'); }); return false; }); }); Logout.php This was working before i built the chat, but since i find that logging out no longer redirects back to the homepage. if (isUserLoggedIn()) { $loggedInUser->userLogOut(); echo"<p class='notify-green' id='notify'>You are now logged out.</p>"; header('Refresh: 2; url=https://openex.pw'); }else{ header( 'Location: index.php'); die(); }
  16. Hello all, new to the forum. I have been struggling with a PHP problem for the past week and have turned to you as a last resort. I have everything set up mostly right, but there are specific features that I need from http://datatables.net/index that I would love to feature on my inventory page. What happens on my page, is that the whole csv contents show. But the rows do not hide as in the examples you can see on the datatables website. The search bar also does not appear. These are standard features nestled within the datatables.js code. So I am guess they disappear because of the way the PHP is set up to view the rows. These features are really important for the future functionality of my site as well! I have the PHP code as follows: <?php set_time_limit(0); function csv_split($line,$delim=',',$removeQuotes=true) { #$line: the csv line to be split #$delim: the delimiter to split by #$removeQuotes: if this is false, the quotation marks won't be removed from the fields $fields = array(); $fldCount = 0; $inQuotes = false; for ($i = 0; $i < strlen($line); $i++) { if (!isset($fields[$fldCount])) $fields[$fldCount] = ""; $tmp = substr($line,$i,strlen($delim)); if ($tmp === $delim && !$inQuotes) { $fldCount++; $i += strlen($delim)-1; } else if ($fields[$fldCount] == "" && $line[$i] == '"' && !$inQuotes) { if (!$removeQuotes) $fields[$fldCount] .= $line[$i]; $inQuotes = true; } else if ($line[$i] == '"') { if ($line[$i+1] == '"') { $i++; $fields[$fldCount] .= $line[$i]; } else { if (!$removeQuotes) $fields[$fldCount] .= $line[$i]; $inQuotes = false; } } else { $fields[$fldCount] .= $line[$i]; } } return $fields; } $html_body = '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="/css/demo_page.css"> <link rel="stylesheet" type="text/css" href="/css/demo_table.css"> <title>CSV Contents</title> <style type="text/css"> <!-- .style5 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .style9 {font-size: 12px} .logo h1 {position: absolute; top: 5px; right: 5px; font-size:14px; } .logo img-with-text {float: left; left 5px; font-size:14px; .img-with-text {text-align: justify; width: 40%; height: 20%;} .img-with-text img {display: block; margin: 0 auto;} .search {margin : 0px;} --> </style> <script class="jsbin" src="http://datatables.net/download/build/jquery.dataTables.nightly.js"></script> <script type="text/javascript" language="javascript" src="/js/jquery.js"></script> <div class="img-with-text"> <img src="/image002.png" alt="sometext" /> <p>WC" is West Coast warehouse- please add approximately 2-3 weeks for the arrival to East Coast.<br><br> </p> </div> <div class="logo"> <br>Last Updated on '.date("F j, Y, g:i a",time()+3600).' </h1> </div> </head> <body id="dt_example"> <div id="container"> <h1> Check Inventory Here</h1> <table> <thead> <tr> <th>Item No</th> <th>Description</th> <th>Price</th> <th>Available</th> <th>Back Ordered</th> <th>On Order</th> <th>ETA WH</th> <th>WC On Hand</th> <th>WC On Ord</th> <th>WC Order Date</th> </tr> </thead> <tbody> '; $fp=fopen("csv/inventory4.html",'w'); $write=fputs($fp,$html_body,strlen($html_body)); $i=0; $content = file("webinvt.txt"); foreach($content as $line) { $l=csv_split($line); if(!strstr($l[11],"SET")) { if($i==10) { $tmp = '<tr>'; $write=fputs($fp,$tmp,strlen($tmp)); $i=0; } $onhand = (int)$l[15]; $committed = (int)$l[16]; $avail = $onhand - $committed; $wcdate = substr($l[23],4); $eastdate = substr($l[19],4); if(strstr($l[1],"DISC")) { $html_body ='<tr "> <td>'.$l[0].'</td> <td>'.$l[1].'</td> <td>'.$l[12].'</td> <td>'.$avail.'</td> <td>'.$l[17].'</td> <td>'.$l[18].'</td> <td>'.$eastdate.'</td> <td>'.$l[21].'</td> <td>'.$l[22].'</td> <td>'.$wcdate.'</td> </tr>'; } else { $html_body ='<tr> <td>'.$l[0].'</td> <td>'.$l[1].'</td> <td>'.$l[12].'</td> <td>'.$avail.'</td> <td>'.$l[17].'</td> <td>'.$l[18].'</td> <td>'.$eastdate.'</td> <td>'.$l[21].'</td> <td>'.$l[22].'</td> <td>'.$wcdate.'</td> </tr> '; } $write=fputs($fp,$html_body,strlen($html_body)); $i++; } } $html_body=' </tbody> <tfoot> <tr> <th>Item No</th> <th>Description</th> <th>Price</th> <th>Available</th> <th>Back Ordered</th> <th>On Order</th> <th>ETA WH</th> <th>WC On Hand</th> <th>WC On Ord</th> <th>WC Order Date</th> </tr> </tfoot> </table> </body> </html>'; $write=fputs($fp,$html_body,strlen($html_body)); fclose($fp); ?> Furthermore, I have to include this piece of javascript inside the HTML variable.: $(document).ready(function() { $('#example').dataTable(); } ); Any help will be greatly appreciated!
  17. I'm completely stuck and I need help. I've been trying to create a picture framing utility (for photos etc). where the user can specify the size of their photo, then choose a coloured cardboard mount and a frame type to go around it. The site my client chose for me to create something similar to is this: http://www.ezeframe.co.uk/picture-frames You can see that the user can specify their picture size, frame and mount, and see it taking shape on screen. Where I've come unstuck is the scaling. You can see in the above example that if someone changes their mount size or frame type, they change so that they remain in proportion to the picture size. I've been trying to make my system do the same and I'm failing! I'm sure it's my maths that's wrong but can't work out where. What I've done so far (without scaling) can be seen on the clients live site here: www.vivarti.co.uk/bespoke-frames I've done it mostly using CSS, Jquery and AJAX. The way it works is that I have a fixed pixel area to work within. When the user alters the size of frame moulding, or the cardboard mount, it needs to scale the 'image area', mount and frame in proportion. I've tried doing it using fixed pixel width, percentage width and every other way I can think of, but I still can't get it to work properly. Is there a better way to do this kind of thing than using Jquery, or can anyone help me work out the maths to make my version scale? A tall order I know but I'm just hoping someone can help me! Thanks in advance.
  18. I downloaded this source package for a poll system that runs on jquery and php. Here is the "to do" list to make the program work. 1. Setup mysql database to have one row and x number of columns (however many questions in poll). 2. Configure updatePoll.php with database location, name, and password. 3. Include in index.php file the required JS: createPoll.js style.css from jQuery: jquery-1.4.4.min.js jquery.ui.core.js jquery.easing.1.3.js jquery.core.js 4. Load index.html in your browser! i 5. Style poll questions using the style.css, and/or change to be traditional poll (i.e. radio buttons). 6. Demo: http://www.bheberto.com/devblog.php?id=5 I got steps 1 and 2 done. I also got part of 3 done. How do you include the jquery-1.4.4.min.js? is that something your download? I know nothing about jquery, I only know php, html, and css right now. index.html style.css updatePoll.php
  19. im using the jquery UI datepicker to submit a date to my database but i keep storing 0000-00-00 instead of the date how do I make the date show up in the database? can someone help me?
  20. Hi Guys and Gals The below code reads from a database and builds a tree structure. But my problem is in the collapse and expanding of the 'child' tr. Currently it expands the next tr, but if there is more than 1 child you have to first click the first chhild to expand the second child and so forth. Is there a way with jquery to expand a class until the next occurance of another class? <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> </head> <?php mysql_connect('localhost','root',''); mysql_select_db('samaedbm'); ini_set('display_errors', 1); ini_set('memory_limit', '640M'); ini_set('max_execution_time', 6000); error_reporting(E_ALL); function addnode($pid, $ind, $search){ global $modx; $sql = "select * from edbm_content where parentid = '".$pid. "' and description like '%". $search . "%'"; $ind .= '-'; $res = mysql_query($sql); while ($row = mysql_fetch_array($res)){ if ($pid == $row["id"]) { if (strlen($ind) == 1){ echo '<tr class="header0" id="header0"><td><span class="expanderSign">[+]</span> ' . $row["description"].'</td><td>'.$row["parentid"].'</td><td>'.$row["id"].'</td></tr>'; } } if ($pid != $row["id"]) { if (strlen($ind) == 1){ echo '<tr class="header1" id="header1" style="display:none;"><td style="padding-left:10px;"><span class="expanderSign">[+]</span> ' . $row["description"].'</td><td>'.$row["parentid"].'</td><td>'.$row["id"].'</td></tr>'; } if (strlen($ind) == 2){ echo '<tr class="header2" id="header2" data-for="header1" style="display:none;"><td style="padding-left:20px;"><span class="expanderSign">[+]</span> ' . $row["description"].'</td><td>'.$row["parentid"].'</td><td>'.$row["id"].'</td></tr>'; } if (strlen($ind) == 3){ echo '<tr data-for="header3" style="display:none;"><td style="padding-left:30px;"><span class="expanderSign">[+]</span> ' . $row["description"].'</td><td>'.$row["parentid"].'</td><td>'.$row["id"].'</td></tr>'; } addnode($row["id"], $ind, $search); } } return; } echo '<table style="font-size:13;">'; addnode(505000, '', ''); echo '</table>'; ?> <script type="text/javascript"> $(".header0").click(function() { $(".header1").slideToggle(500); if (jQuery(".expanderSign").text() == "[+]"){ jQuery(".expanderSign").text("[-]"); } else { jQuery(".expanderSign").text("[+]"); } }); $(".header1").children("td").click(function() { $(obj).closest('tr').nextAll(':has(.header2):first').find('.header2').show(); if (jQuery(".expanderSign").text() == "[+]"){ jQuery(".expanderSign").text("[-]"); } else { jQuery(".expanderSign").text("[+]"); } }); $(".header2").children("td").click(function() { $(this).parent().next("tr").show(); if (jQuery(".expanderSign").text() == "[+]"){ jQuery(".expanderSign").text("[-]"); } else { jQuery(".expanderSign").text("[+]"); } }); </script>
  21. Hello, I am looking for someone that can redesign my old form and make some validation changes... Things I need the form to do: Confirm leaving the page, if it is done other than by submitting the form There is a place for three different phone numbers, home, work, and mobile, I only need to ensure that at least one of those is filled out, more can be, but one is required Proper character input type validation, phone numbers, zip code, email address Required fields, some of which are of the HTML "select" type of input Format masking, e.g. phone numbers Needs to be multi-browser compatible, Firefox, Chrome, IE, Safari The form needs to be smooth and curvy, very jQuery / AJAX Convert the MySQL to MySQLi The form should have it's own css, so that it can stand alone on it's own, but not conflict with other css either, e.g. start all of it's css with something like "form_" or something Improve upon the PHP as you see fit If you can make or add a better way to put in a date of birth, other than 3 drop-down boxes, then that would be good as well In the form there is also a question of whether or not an address is the same as another address, if so, it copies the address info, if not, it shows a new div, for a new address, the form will still need that functionality as well P.S. The form is called via an SSL secure page Please contact me with your quotes and any forms that you would like to show off, at motorsportfun2013 [@] gmail dot com Since I apparently can't attach the page, I'll post the code of what I'm currently using... <? require 'includes/auth.php'; $AgentID = $_SESSION['AgentID']; $AgentName = $_SESSION['AgentName']; if (isset($_GET['orderticketid'])) { $orderticketid = clean($_GET['orderticketid']); $result = mysql_query(" SELECT OrderTickets.*, Agencies.AgencyName, InsuranceCarriers.InsuranceCarrier FROM OrderTickets LEFT JOIN Agencies ON OrderTickets.AgencyID = Agencies.AgencyID LEFT JOIN InsuranceCarriers ON OrderTickets.InsuranceCarrierID = InsuranceCarriers.InsuranceCarrierID WHERE OrderTickets.OrderTicketID = '$orderticketid' AND OrderTickets.AgentID = '$AgentID' "); while ($OrderTicketRow = mysql_fetch_assoc($result)) { $InsuranceCarrierID = $OrderTicketRow['InsuranceCarrierID']; $InsuranceCarrierPolicyNumber = $OrderTicketRow['InsuranceCarrierPolicyNumber']; $OrderTicketFirstName = $OrderTicketRow['OrderTicketFirstName']; $OrderTicketMiddleName = $OrderTicketRow['OrderTicketMiddleName']; $OrderTicketLastName = $OrderTicketRow['OrderTicketLastName']; $OrderTicketAddress = $OrderTicketRow['OrderTicketAddress']; $OrderTicketCity = $OrderTicketRow['OrderTicketCity']; $OrderTicketState = $OrderTicketRow['OrderTicketState']; $OrderTicketZipCode = $OrderTicketRow['OrderTicketZipCode']; $OrderTicketExamLocation = $OrderTicketRow['OrderTicketExamLocation']; $OrderTicketExamLocationAddress = $OrderTicketRow['OrderTicketExamLocationAddress']; $OrderTicketExamLocationCity = $OrderTicketRow['OrderTicketExamLocationCity']; $OrderTicketExamLocationState = $OrderTicketRow['OrderTicketExamLocationState']; $OrderTicketExamLocationZipCode = $OrderTicketRow['OrderTicketExamLocationZipCode']; $OrderTicketHomePhone = $OrderTicketRow['OrderTicketHomePhone']; $OrderTicketWorkPhone = $OrderTicketRow['OrderTicketWorkPhone']; $OrderTicketMobilePhone = $OrderTicketRow['OrderTicketMobilePhone']; $OrderTicketEmailAddress = $OrderTicketRow['OrderTicketEmailAddress']; $OrderTicketDOBMonth = date('m', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketDOBDay = date('d', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketDOBYear = date('Y', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketGender = $OrderTicketRow['OrderTicketGender']; $OrderTicketSmoker = $OrderTicketRow['OrderTicketSmoker']; $OrderTicketPolicyType = $OrderTicketRow['OrderTicketPolicyType']; $OrderTicketPolicyAmount = $OrderTicketRow['OrderTicketPolicyAmount']; $OrderTicketSpecialInstructions = $OrderTicketRow['OrderTicketSpecialInstructions']; } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="includes/JavaScriptValidationFunctions.js"></script> <script type="text/javascript" src="includes/Modernizr-2.5.3.forms.js"></script> <script type="text/javascript" data-webforms2-support="validation" src="includes/html5Forms.js"></script> <script src="includes/jquery.maskedinput-1.3.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#OrderTicketHomePhone").mask("(999) 999-9999"); jQuery("#OrderTicketWorkPhone").mask("(999) 999-9999"); jQuery("#OrderTicketMobilePhone").mask("(999) 999-9999"); }); </script> <script type="text/javascript"> window.onbeforeunload = function() { return 'You have unsaved changes!'; } </script> <script type="text/javascript"> function ShowHide(){ if (document.getElementById("OrderTicketExamLocation").value == '') { $('.show_hide').hide(); } if (document.getElementById("OrderTicketExamLocation").value != 'Home') { $('.show_hide').show(); } else if (document.getElementById("OrderTicketExamLocation").value == 'Home') { $('.show_hide').hide(); } } </script> <title>Submit Order Ticket</title> </head> <body> <div id="LogoHeader"> <img src="images/logo.png" /> </div> <div id="Menu"> <? include 'includes/menu.php'; ?> </div> <div class="jQueryErrors"> </div> <div id="OrderForm"> <br /> <form id="submitorderform" action="submitorderticket-action.php" method="post" onsubmit="return validateOrderSubmissionForm();"> <input id="submitneworderticket" name="submitneworderticket" value="submitneworderticket" type="hidden" /> <fieldset> <div class="FormRow"> <div class="FormLabel"> <label for="InsuranceCarrierID">* Insurance Carrier:</label> </div> <div class="FormInput"> <? $CarriersResult = mysql_query("SELECT InsuranceCarriersAgents.InsuranceCarrierID, InsuranceCarriers.InsuranceCarrier FROM InsuranceCarriersAgents LEFT JOIN InsuranceCarriers ON InsuranceCarriersAgents.InsuranceCarrierID = InsuranceCarriers.InsuranceCarrierID WHERE InsuranceCarriersAgents.AgentID = '$AgentID'") or die(mysql_error()); $rowCounter = mysql_num_rows($CarriersResult); if ($rowCounter == 0) { echo '<span style="background-color: #C0C0C0; color: red; padding: 2px;">You Are Not Associated With Any Insurance Carriers, Click On <a href="carrier-agent-correlations.php">Insurance Carriers</a> To Add It/Them.<span>'; } if ($rowCounter > 1) { echo '<select id="InsuranceCarrierID" name="InsuranceCarrierID">'; echo '<option value=""> ... </option>'; } while ($temprow = mysql_fetch_assoc($CarriersResult)) { if ($rowCounter == 1) { echo '<input type="hidden" id="InsuranceCarrierID" name="InsuranceCarrierID" value="'.$temprow['InsuranceCarrierID'].'" />'; echo '<input style="color: #515151;" type="text" id="InsuranceCarrier" name="InsuranceCarrier" value="'.$temprow['InsuranceCarrier'].'" size="50" READONLY />'; } if ($rowCounter > 1) { echo '<option value="'.$temprow['InsuranceCarrierID'].'">'.$temprow['InsuranceCarrier'].'</option>'; } } if ($rowCounter > 1) { echo '</select>'; } ?> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="AgencyID">* Agency Name:</label> </div> <div class="FormInput"> <? $AgenciesResult = mysql_query("SELECT AgenciesAgents.AgencyID, Agencies.AgencyName FROM AgenciesAgents LEFT JOIN Agencies ON AgenciesAgents.AgencyID = Agencies.AgencyID WHERE AgenciesAgents.AgentID = '$AgentID'") or die(mysql_error()); $rowCounter = mysql_num_rows($AgenciesResult); if ($rowCounter == 0) { echo '<span style="background-color: #C0C0C0; color: red; padding: 2px;">You Are Not Associated With Any Agencies, Please Call ParaMedDirect.<span>'; } if ($rowCounter > 1) { echo '<select id="AgencyID" name="AgencyID">'; echo '<option value=""> ... </option>'; } while ($temprow = mysql_fetch_assoc($AgenciesResult)) { if ($rowCounter == 1) { echo '<input type="hidden" id="AgencyID" name="AgencyID" value="'.$temprow['AgencyID'].'" />'; echo '<input style="color: #515151;" type="text" id="AgencyName" name="AgencyName" value="'.$temprow['AgencyName'].'" size="50" READONLY />'; } if ($rowCounter > 1) { echo '<option value="'.$temprow['AgencyID'].'">'.$temprow['AgencyName'].'</option>'; } } if ($rowCounter > 1) { echo '</select>'; } ?> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="AgentID">* Agent Name:</label> </div> <div class="FormInput"> <input type="hidden" id="AgentID" name="AgentID" value="<? echo $AgentID; ?>" /> <input style="color: #515151;" type="text" id="AgentName" name="AgentName" value="<? echo $AgentName; ?>" READONLY /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="InsuranceCarrierPolicyNumber"> Policy Number:</label> </div> <div class="FormInput"> <input id="InsuranceCarrierPolicyNumber" name="InsuranceCarrierPolicyNumber" type="text" value="<? echo $InsuranceCarrierPolicyNumber; ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketFirstName">* Client Name:</label> </div> <div class="FormInput"> <input id="OrderTicketFirstName" name="OrderTicketFirstName" type="text" value="<? echo $OrderTicketFirstName; ?>" required /> <input id="OrderTicketMiddleName" name="OrderTicketMiddleName" type="text" value="<? echo $OrderTicketMiddleName; ?>" size="1" /> <input id="OrderTicketLastName" name="OrderTicketLastName" type="text" value="<? echo $OrderTicketLastName; ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketAddress">* Address:</label> </div> <div class="FormInput"> <input id="OrderTicketAddress" name="OrderTicketAddress" type="text" value="<? echo $OrderTicketAddress; ?>" required size="50" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketCity">* City:</label> </div> <div class="FormInput"> <input id="OrderTicketCity" name="OrderTicketCity" type="text" value="<? echo $OrderTicketCity; ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketState">* State:</label> </div> <div class="FormInput"> <select id="OrderTicketState" name="OrderTicketState"> <option value=""> ... </option> <? $StateResult = mysql_query("SELECT * FROM States WHERE 1"); while ($StateRow = mysql_fetch_assoc($StateResult)) { echo '<option value="'.$StateRow['StateAbbr'].'"'; if ($StateRow['StateAbbr'] == $OrderTicketState){echo ' SELECTED';} elseif ($StateRow['StateAbbr'] == "MO"){echo ' SELECTED';} echo '>'.$StateRow['State'].'</option>'; } ?> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketZipCode">* Zip Code:</label> </div> <div class="FormInput"> <input id="OrderTicketZipCode" name="OrderTicketZipCode" type="text" value="<? echo $OrderTicketZipCode; ?>" pattern="[0-9]{5}" required /> </div> </div> <br /> <div class="FormRow"> <span style="font-weight: 600;">Enter Exam Location if Different from Client Location.</span> </div> <br /> <div class="FormRow"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocation">Exam Location:</label> </div> <div class="FormInput"> <select id="OrderTicketExamLocation" name="OrderTicketExamLocation" onchange="ShowHide()"> <? $ExamLocationResult = mysql_query("SELECT * FROM ExamLocations"); while ($ExamLocationRow = mysql_fetch_assoc($ExamLocationResult)) { echo '<option value="'.$ExamLocationRow['ExamLocation'].'"'; if ($ExamLocationRow['ExamLocation'] == $OrderTicketExamLocation){echo ' SELECTED';} echo '>'.$ExamLocationRow['ExamLocation'].'</option>'; } ?> </select> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationAddress">Exam Location Address:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationAddress" name="OrderTicketExamLocationAddress" type="text" value="<? echo $OrderTicketExamLocationAddress; ?>" size="50" /> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationCity">Exam Location City:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationCity" name="OrderTicketExamLocationCity" type="text" value="<? echo $OrderTicketExamLocationCity; ?>" /> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationState">Exam Location State:</label> </div> <div class="FormInput"> <select id="OrderTicketExamLocationState" name="OrderTicketExamLocationState"> <option value=""> ... </option> <? $StateResult = mysql_query("SELECT * FROM States"); while ($StateRow = mysql_fetch_assoc($StateResult)) { echo '<option value="'.$StateRow['StateAbbr'].'"'; if ($StateRow['StateAbbr'] == $OrderTicketExamLocationState){echo ' SELECTED';} elseif ($StateRow['StateAbbr'] == "MO"){echo ' SELECTED';} echo '>'.$StateRow['State'].'</option>'; } ?> </select> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationZipCode">Exam Location Zip Code:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationZipCode" name="OrderTicketExamLocationZipCode" type="text" value="<? echo $OrderTicketExamLocationZipCode; ?>" pattern="[0-9]{5}" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketHomePhone">* Home Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketHomePhone" name="OrderTicketHomePhone" type="tel" value="<? echo formatPhone($OrderTicketHomePhone); ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketWorkPhone"> Work Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketWorkPhone" name="OrderTicketWorkPhone" type="tel" value="<? echo formatPhone($OrderTicketWorkPhone); ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketMobilePhone"> Mobile Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketMobilePhone" name="OrderTicketMobilePhone" type="tel" value="<? echo formatPhone($OrderTicketMobilePhone); ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketEmailAddress"> Email Address:</label> </div> <div class="FormInput"> <input id="OrderTicketEmailAddress" name="OrderTicketEmailAddress" type="email" size="50" value="<? echo $OrderTicketEmailAddress; ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketDOBMonth">* Date of Birth:</label> </div> <div class="FormInput"> <select id="OrderTicketDOBMonth" name="OrderTicketDOBMonth"> <option value=""> ... </option> <? for ($i=1;$i<13;$i++) { $i = sprintf('%02d', $i); echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBMonth) {echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> <select id="OrderTicketDOBDay" name="OrderTicketDOBDay"> <option value=""> ... </option> <? for ($i=1;$i<32;$i++) { $i = sprintf('%02d', $i); echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBDay) {echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> <select id="OrderTicketDOBYear" name="OrderTicketDOBYear"> <option value=""> ... </option> <? $thisYear = date('Y'); for ($i=1900;$i<$thisYear;$i++) { echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBYear){echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketGender">* Gender:</label> </div> <div class="FormInput"> <select id="OrderTicketGender" name="OrderTicketGender"> <option value=""> ... </option> <option value="Male" <? if ($OrderTicketGender == "Male"){echo ' SELECTED';} ?>>Male</option> <option value="Female" <? if ($OrderTicketGender == "Female"){echo ' SELECTED';} ?>>Female</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketSmoker">* Tobacco User:</label> </div> <div class="FormInput"> <select id="OrderTicketSmoker" name="OrderTicketSmoker"> <option value=""> ... </option> <option value="Yes" <? if ($OrderTicketSmoker == "Yes"){echo ' SELECTED';} ?>>Yes</option> <option value="No" <? if ($OrderTicketSmoker == "No"){echo ' SELECTED';} ?>>No</option> <option value="NA" <? if ($OrderTicketSmoker == "NA"){echo ' SELECTED';} ?>>Not Applicable</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketPolicyType">* Policy Type:</label> </div> <div class="FormInput"> <select id="OrderTicketPolicyType" name="OrderTicketPolicyType"> <option value=""> ... </option> <option value="LifeTerm" <? if ($OrderTicketPolicyType == "LifeTerm"){echo ' SELECTED';} ?>>Life (term)</option> <option value="LifeVariable" <? if ($OrderTicketPolicyType == "LifeVariable"){echo ' SELECTED';} ?>>Life (variable)</option> <option value="Disability" <? if ($OrderTicketPolicyType == "Disability"){echo ' SELECTED';} ?>>Disability</option> <option value="Health" <? if ($OrderTicketPolicyType == "Health"){echo ' SELECTED';} ?>>Health</option> <option value="LTC" <? if ($OrderTicketPolicyType == "LTC"){echo ' SELECTED';} ?>>LTC</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketPolicyAmount">* Policy Amount:</label> </div> <div class="FormInput"> <input id="OrderTicketPolicyAmount" name="OrderTicketPolicyAmount" type="text" value="<? if ($OrderTicketPolicyAmount != 0) echo number_format($OrderTicketPolicyAmount, 2); ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketSpecialInstructions"> Special Instructions:</label> </div> <div class="FormInput"> <textarea id="OrderTicketSpecialInstructions" name="OrderTicketSpecialInstructions" cols="40" rows="7"><? echo $OrderTicketSpecialInstructions; ?></textarea> </div> </div> <br /> <div class="FormRow"> <div class="FormSubmit"> <input id="submit" type="submit" value="Submit" /> </div> </div> <br /> </fieldset> <div id="sitesealdiv"> <span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=nezI8DdJpwJdyKY47vVrSgFuL1UYVfwDggv4JN4ykS5AumDDidYzrl"></script></span> </div> </form> </div> </body> </html>
  22. I have this bellow code its a jquery to add form elements dynamically. my question is when Im submiting the form to the database it only send first set of elements value only, rest are not sending to the database, plz help me on this.. here is my codes. jquery- <script type="text/Javascript"> $(document).ready(function() { $('#btnAdd').click(function() { var num = $('.clonedSection').length; var newNum = new Number(num + 1); var newSection = $('#pq_entry_' + num).clone().attr('id', 'pq_entry_' + newNum); newSection.children(':first').children(':first').attr('id', 'contNo_' + newNum).attr('name', 'contNo_' + newNum); newSection.children(':nth-child(2)').children(':first').attr('id', 'contNo2_' + newNum).attr('name', 'contNo2_' + newNum); newSection.children(':nth-child(3)').children(':first').attr('id', 'contNo3_' + newNum).attr('name', 'contNo3_' + newNum); newSection.children(':nth-child(4)').children(':first').attr('id', 'contNo4_' + newNum).attr('name', 'contNo4_' + newNum); newSection.children(':nth-child(5)').children(':first').attr('id', 'contNo5_' + newNum).attr('name', 'contNo5_' + newNum); newSection.children(':nth-child(6)').children(':first').attr('id', 'contNo6_' + newNum).attr('name', 'contNo6_' + newNum); newSection.insertAfter('#pq_entry_' + num).last(); $('#btnDel').prop('disabled',''); if (newNum == 5) $('#btnAdd').prop('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedSection').length; // how many "duplicatable" input fields we currently have $('#pq_entry_' + num).remove(); // remove the last element // enable the "add" button $('#btnAdd').prop('disabled',''); // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').prop('disabled','disabled'); }); $('#btnDel').prop('disabled','disabled'); }); //$('#blinfo').on('submit', function (e) { //prevent the default submithandling // e.preventDefault(); //send the data of 'this' (the matched form) to yourURL // $.post('bladd.php', $(this).serialize()); //}); </script> Here is the HTML (both codes are in the same file) <ul id="pq_entry_1" class="clonedSection"> <li><input type="text" name="contNo_1" id="contNo_1" size="45" value=""/></li> <li>SIZE<input type="text" name="contNo2_1" id="contNo2_1" size="15" value=""/></li> <li>MODE<input type="text" name="contNo3_1" id="contNo3_1" size="15" value=""/></li> <li>PICES<input type="text" name="contNo4_1" id="contNo4_1" size="15" value=""/></li> <li>WEIGHT<input type="text" name="contNo5_1" id="contNo5_1" size="15" value=""/></li> <li>VOLUME<input type="text" name="contNo6_1" id="contNo6_1" size="15" value=""/></li> </ul> <input type='button' id='btnAdd' size="15" value='add another row' /><input type='button' id='btnDel' value='delete row' /> and here is my sql query <?php $con=mysqli_connect("localhost","root","1234","shipping"); // Check connection if (mysqli_connect_errno()) { mysqli_connect_error(); } $sql="INSERT INTO infobl (contNo_1, contNo2_1, contNo3_1, contNo4_1, contNo5_1, contNo6_1, contNo_2, contNo2_2, contNo3_2, contNo4_2, contNo5_2, contNo6_2, datetime) VALUES ('$_POST[contNo_1]','$_POST[contNo2_1]','$_POST[contNo3_1]','$_POST[contNo4_1]','$_POST[contNo5_1]','$_POST[contNo6_1]','$_POST[contNo_2]','$_POST[contNo2_2]','$_POST[contNo3_2]','$_POST[contNo4_2]','$_POST[contNo5_2]','$_POST[contNo6_2]',NOW())"; if (!mysqli_query($con,$sql)) { die('<font color="#FF0000"><h2>Error: ---PLEASE CHECK YOUR NUMBER AGAIN....<br />Press Back on the browser.... </h2></font>' . mysqli_error($con)) ; } else header('location: /bldrft/edits/view.php'); mysqli_close($con); ?> I can't figure it out what was the wrong, all are fine to me, plzz help guys. thanks.
  23. Hi, I have problem with this line var value = $("#opstina option:selected").val(); , but only in chrome i get that value is undefined. In FireFox, and IE, works fine, only in chrome i get this warning. Does someone know why? My whole jquery code is if ($("#drzava option:selected").length) { $("select#opstina").attr("disabled","disabled"); $("select#opstina").html("<option>wait...</option>"); var id = $("select#drzava option:selected").attr('value'); $.post("select_opstina.php", {id:id}, function(data){ $("select#opstina").removeAttr("disabled"); alert( "html koji bi trebao biti upisan u select:\n\n" + data ); $("select#opstina").html(data); }); if ($("#opstina option:selected").length) { alert('Došao sam pred petlju'); var value = $("#opstina option:selected").val();//this is line that is problem alert(value); var sel = $("#opstina").val(); // this do the same if (sel!=0) { alert('Ušao sam u petlju, i selektovano polje za opštinu je' + sel ); $("select#mesto").attr("disabled","disabled"); $("select#mesto").html("<option>wait...</option>"); var id= $("select#opstina option:selected").attr('value'); alert(id); $.post("select_mesto.php", {id:id}, function(data){ alert("html koji bi trebao biti upisan u select:\n\n" + data ); $("select#mesto").removeAttr("disabled"); $("select#mesto").html(data); }); } } } }
  24. Hi, I have a page like this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <style> .add-another-cat { /*float:right; */ background-image:url(add_btn.png); width:18px; height:18px; } </style> <!-- for list --> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <style> #sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; height: 1.5em; } html>body #sortable li { height: 1.5em; line-height: 1.2em; } .ui-state-highlight { height: 1.5em; line-height: 1.2em; } </style> <script> $(function() { $( "#sortable" ).sortable({ placeholder: "ui-state-highlight" }); $( "#sortable" ).disableSelection(); }); </script> </head> <body> <script language="javascript"> //<![CDATA[ $(window).load(function(){ $('.add-another-cat').click(function(event){ event.preventDefault(); var $orDiv = $('.new-category:last').after($('#clone').clone().removeAttr('id').show()); }); $('.new-categories').html($('#clone').clone().removeAttr('id').show()); });//]]> </script> <div id="clone" class="new-category" style="display:none;"> <select class="category-select" name="localprojects"> <option value="1">mca 1</option> <option value="2">mca 2</option> </select> <===> <select class="category-select" name="remoteprojects"> <option value="z1">zoho 1</option> <option value="z2">zoho 2</option> </select> <select class='category-select-sub' style="display:none"> <!-- loaded from ajax --> </select> </div> <div class="new-categories" style="display: inline-block;"> </div> <a href="#" class="add-another-cat smallest" style="display: inline-block;"></a> <ul id="sortable"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> <li class="ui-state-default">Item 6</li> <li class="ui-state-default">Item 7</li> </ul> </body> </html> I like to get the selected values from the 2 comboboxes, combine them together as a string and add to the list <ul id="sortable"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> <li class="ui-state-default">Item 6</li> <li class="ui-state-default">Item 7</li> </ul> For example: if user selects "mca 1" (value "1") and "zoho 2" (value "z2") then the following html code should be auto generated. <li class="ui-state-default" value="1-z2">mca 1 - zoho 2</li> Would you please tell me how to do this? Thanks.
  25. Hello all! I've written a jQuery addMethod for the jQuery validation plugin that seems to be causing an error. Basically this method just checks the db to see if the email address is registered. It works correctly and prompts the error/or passes it correctly. However it fired back an error and sets the focus to the field on submit. If I take this out, the form fires correctly no problem. Any insight I would appreciate. Submit Handler: submitHandler: function(form) { if($("#registerForm").valid()) { $.ajax({ type: "POST", async: false, url: "activate.php", data: $("#registerForm").serialize(), success: function(data) { $('#results').html(data); $('#registerForm').fadeOut(1000); $('#thanks').fadeToggle(1000); } }) } }, addMethod $.validator.addMethod("checkEmailAvailability", function(email) { $('#email').blur(function() { $.ajax({ type: "POST", url: "http://"+location.host+"/includes/checkemail.php?", data: "email=" +$("#email").val(), success: function(data) { if(data == 'false') { //$('#checkEmail').removeClass("validate-ok"); $('#checkEmail').addClass("validate-error").html('✗ ' + $("#email").val() + ' is already a registered email.'); } else { $('#checkEmail').html(''); } } }) }); });
×
×
  • 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.