Cibiņš Posted October 19, 2011 Report Share Posted October 19, 2011 (edited) Sveicināti! Nu jau pāris stundas lauzu galvu, kā izvadīt ievadīto datumu uz URL lauku lai adrese būtu localhost/datetime/?from=06.02.2011&till=09.09.2011 jo pašlaik netiek izvilkti dati onchange eventā :( Paļīgā... :( datepicker.zip Edited October 19, 2011 by Cibiņš Quote Link to comment Share on other sites More sharing options...
0 daGrevis Posted October 19, 2011 Report Share Posted October 19, 2011 echo SITE_URL . "/?from=$from&until=$until"; Quote Link to comment Share on other sites More sharing options...
0 Cibiņš Posted October 19, 2011 Author Report Share Posted October 19, 2011 echo SITE_URL . "/?from=$from&until=$until"; Tik stulbs neesmu :D Šeit nav runa par SUBMIT FORM. Paskaties ZIPu tad sapratīsi. Quote Link to comment Share on other sites More sharing options...
0 daGrevis Posted October 19, 2011 Report Share Posted October 19, 2011 Negribu. Quote Link to comment Share on other sites More sharing options...
0 Cibiņš Posted October 19, 2011 Author Report Share Posted October 19, 2011 Negribu. Nu tad nezināsi par ko sūdzos :Dnu moins nu :( Nemāku izskaidrot īsti to problēmu. :( Quote Link to comment Share on other sites More sharing options...
0 mixis Posted October 19, 2011 Report Share Posted October 19, 2011 var url = window.location.pathname + '?from=' + $.datepicker.parseDate('yy-mm-dd', $(".from").val()); Quote Link to comment Share on other sites More sharing options...
0 Cibiņš Posted October 19, 2011 Author Report Share Posted October 19, 2011 (edited) Bet kur tā zaraza ir jāliek ja man pie lauka ir norādīts events onchange="window.location.href='?from=<? echo $_POST['from']; if(isset($_GET['till'])){ ?>&till=<? echo $_GET['till']; } ?>'" Respektīvi - man kods INDEX.PHP failā ir šāds <!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> <link href="jquery-ui.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #ui-datepicker-div{z-index: 2000;} </style> <script language="javascript" type="text/javascript" src="jquery.js"></script> <script language="javascript" type="text/javascript" src="jquery.min.js"></script> <script language="javascript" type="text/javascript" src="jquery-ui.min.js"></script> <script language="javascript" type="text/javascript"> $(function() { $(".datepicker").datepicker({dateFormat: 'dd.mm.yy'}); }); </script> </head> <body> <form method="post" style="overflow: hidden;"> <span class="dataInfo">From:</span> <label><input name="from" type="text" class="inputDate datepicker" maxlength="10" style="width: 117px;" onchange="window.location.href='?from=<? echo $_POST['from']; if(isset($_GET['till'])){ ?>&till=<? echo $_GET['till']; } ?>'" /></label> <span class="dataInfo">Till:</span> <label><input name="till" type="text" class="inputDate datepicker" maxlength="10" style="width: 118px;" onchange="window.location.href='?<? if(isset($_GET['from'])){ ?>from=<? echo $_GET['from']; ?>&<? } ?>till=$untill'" /></label> </form> </body> </html> Edited October 19, 2011 by Cibiņš Quote Link to comment Share on other sites More sharing options...
0 indoom Posted October 19, 2011 Report Share Posted October 19, 2011 (edited) formai liec method="get" un pieliec submit pogu, un ņem nost tos onchange. Uz onchange likt, ka lapa pārlādējas, manuprāt, ir dumji. Pirmkārt, lapa pārlādēsies jau nomainot vienu no laukiem, nedodot iespēju nomainīt otru. Bez tam, šaubos vai ar datepickeru nomainītais saturs izsauc onchange eventu automātiski. +kāpēc tiek ielādēts jquery divreiz? <script language="javascript" type="text/javascript" src="jquery.js"></script> <script language="javascript" type="text/javascript" src="jquery.min.js"></script> Edited October 19, 2011 by indoom Quote Link to comment Share on other sites More sharing options...
0 Cibiņš Posted October 19, 2011 Author Report Share Posted October 19, 2011 (edited) Jādara kā klients liek, viņam nepatīk tās submit pogas. Kapēc gan nedod iespēju nomainīt otru?? Pieliek vienkārši laukā pārbaudi lai parāda vērtību no GET['from'], kur vērtība ir izvadīta URL laukā. Piemēram izvēlas datumu no lauka "from", nostrādā lapas pārlāde un vērtība tiek izvadīta URL laukā, savukārt ja URL laukā ir vērtība, tad ar GET['from'] tā tiek atspoguļota formas laukā. Tāpat arī otrs. Jo šī padarīšana nav paredzēta submitam uz datubāzi, bet gan tiks palaists kvērijs datu atlasei. Tā kā klients lika tā ir jādara. Tikai nedalec, KĀ lai ar to onchange izvada to vērtību, jo piemēram <select class="inputField2" onchange="window.location.href=this.options[this.selectedIndex].value"> <? if(isset($_GET['value'])){ ?> <option value="?pg=report&value=<? echo $_GET['value']; ?>">Vērtība <? echo $_GET['value']; ?></option> <? } ?> <option value="?pg=report&value=1">Vērtība 1</option> <option value="?pg=report&value=2">Vērtība 2</option> </select> viss ir čiki piki. Edited October 19, 2011 by Cibiņš Quote Link to comment Share on other sites More sharing options...
0 indoom Posted October 20, 2011 Report Share Posted October 20, 2011 Tad izmanto onSelect eventu datepickerim. Salīdzina vai nav tas pats, kas inputā, un pārlādē lapu Quote Link to comment Share on other sites More sharing options...
Question
Cibiņš
Sveicināti!
Nu jau pāris stundas lauzu galvu, kā izvadīt ievadīto datumu uz URL lauku
lai adrese būtu localhost/datetime/?from=06.02.2011&till=09.09.2011
jo pašlaik netiek izvilkti dati onchange eventā :(
Paļīgā... :(
datepicker.zip
Edited by CibiņšLink to comment
Share on other sites
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.