Hello Alex, Is <input type="text" name="date" id="idFIV" readonly="true" size="10" class="calendario" style="border:none"> loaded in using ajax?
If it isn't then you don't need to put the date picker into a function, you could do the following: http://pastebin.com/m4ddcd98b If it is loaded with ajax then you need to call the function every time it is loaded into the page. Hope this helps Nalum On Sep 29, 4:30 pm, Alex Barrios <alexba...@gmail.com> wrote: > 2009/9/28 alexbariv <alexba...@gmail.com> > > > > > > > Hi everybody. > > > Let me introduce myself. > > > I'm a developer located in Venezuela (latin america), and i have like > > 2 years using Jquery in every project that came to my hands. Its a > > pleasure to meet you all. > > > For begin, i have a little problem that i hope you can giveme some > > light here: > > > I have created a modal dialog inside a tab with a simple form that has > > a datepicker: > > > <div id="tabs-3" style="font-size:11px;"> > > > <div style="padding-left:75%;"> > > <a href="javascript:void(0)" > > onClick="javascript:{modalForm > > ('idValuation','destiny.php',$(this).text());}"> > > Add Valuation > > </a> > > </div> > > > <div id="idValuation" style="display:none;padding:2px"> > > <table> > > <tr> > > <td valign="top">Comments: </td> > > <td><textarea type="text" name="comment_omit" > > style="width:200px;"></textarea></td> > > </tr> > > <tr> > > <td>Date: </td> > > <td> > > <script type="text/javascript"> > > dateSelector('idFIV'); > > </script> > > <input type="text" name="date" id="idFIV" > > readonly="true" > > size="10" class="calendario" > > style="border:none"> > > </td> > > </tr> > > </table> > > </div> > > </div> > > > So, as you can see i call a function dateSelector and this function > > calls the datePicker like this: > > > function dateSelector(id) { > > > $(document).ready(function() { > > > $("#"+id).css({'border':'none','background- > > color':'#E5E5E5','float':'left'}); > > $("#"+id).datepicker( > > { showOn: 'button', > > buttonImage: 'images/iconos/calendar.png', > > dateFormat:'dd-mm-yy', > > buttonImageOnly: true > > }, > > $.datepicker.regional['es']); > > > }); > > > } > > > The dialog its created like this: > > > function modalForm(id, url, tittle) { > > > if ( !$("#"+id).dialog( 'isOpen' ) ){ > > > $("#"+id).dialog({ > > bgiframe : true, > > closeOnEscape : true, > > resizable : false, > > width : 500, > > modal : true, > > title : tittle, > > beforeclose: function(event, ui) { > > $(this).dialog('destroy'); > > }, > > buttons : { > > 'Cancel' : function() { > > $(this).dialog('close'); > > }, > > 'Add Record' : function() { > > > updateView(''+url+'',''+id+''); > > $(this).dialog('close'); > > } > > } > > }); > > > $("#"+id).dialog('open'); > > > } > > } > > > This works just perfect, the dialog appear, i can select the date, add > > a record to the database, and then just call again the dialog using > > the link. > > > The thing is that when i use this the first time, works perfect, when > > i try to add a second record, the date picker doesnt refresh the > > field. It shows the calendar, but when i select a value, this doesnt > > appear in the input, and even more strange, if i close de dialog and > > then reopen, it appears the value that i tried to select, selected, > > but the same problem again. > > > What i am doing wrong with this ? Why works only the first time and > > then breaks? > > > Thanks in advance for all your help! :-D > > Hi Again. > > After some testing, still nothing appears to work. I put a simple > calendar and nothing. Could be that this modal its inside the tab > plugin also ? > > -- > Alex Barrios