I don't see in your code the use of the overloaded ajaxText that I posted. Have you tried it?
Marius On Aug 17, 10:20 pm, g-man <[email protected]> wrote: > OK, thanks for checking back... > > Snippet: > swappable(<span class='dueon'>{task.dueOn.toString}</span>, > <span class='chgDueon'>{ajaxText(task.dueOn.toString, > v => { task.dueOn(v.toLong).save; reDrawTasks(); > }) % ("size" -> "10")}</span>) > > JS: > $chgDueon // jQuery selection for text field > .datepicker({dateFormat:'m-d-yy', minDate: +1}) > .blur(function(){$chgDueon.val(parseDate($chgDueon.val()));}); > // works well to pick a new date and change it to millis for save > > Emitted XHTML: > <span> > <span class="dueon" id="F111290299287IBE" > onclick="jQuery('#'+'F111290299287IBE').hide(); > jQuery('#'+'F1112902992880KN').show().each(function(i) { > var t = this; setTimeout(function() { t.focus(); }, > 200);});return false;;"> > 1248493271843</span> > <span style="display: none" id="F1112902992880KN" > onblur="jQuery('#'+'F111290299287IBE').show(); > jQuery('#'+'F1112902992880KN').hide();"> > <input onblur="lift_ajaxHandler('F111290299286DL1=' + > encodeURIComponent(this.value), null, null)" > type="text" value="1248493271843" > onkeypress="lift_blurIfReturn(event)" size="10" /> > </span> > </span> > > So, all the parts work well together, but Lift's ajax just takes off > too quickly, and cannot read the new value. > > On Aug 16, 11:02 pm, "marius d." <[email protected]> wrote: > > > You can probably use this definition of ajaxText: > > > def ajaxText(value: String, jsFunc: Call, func: String => JsCmd) > > > See the jsFunc parameter. Essentially you are specifying your function > > call that may have one parameter. To your parameter list List we'll > > add a new parameter which is the ajax invocation function. In other > > words your code gets that function that does the ajax call meaning > > that you have the control over when the ajax call is made. > > > Br's, > > Marius > > > On Aug 17, 8:55 am, "marius d." <[email protected]> wrote: > > > > Would you please post a code snippet with what you're doing? (a > > > minimalistic example) > > > > Br's, > > > Marius > > > > On Aug 17, 7:41 am, g-man <[email protected]> wrote: > > > > > I am moving nicely with my 'save all dates as millis and let the > > > > client localize for display' project, learning while enhancing the > > > > ToDo sample app. > > > > > I have added a 'dueOn' field, and that is displayed as swappable > > > > ajaxText, similar to the other fields in the tutorial. > > > > > I have enabled datepicker for the ajaxText field via jQuery, and have > > > > a parsing function attached an event listener, so when datepicker > > > > finishes, the date is converted to millis, ready for Lift to send back > > > > to the server and save. > > > > > So far, all good. > > > > > The problem is that Lift's ajax starts ('onblur') before it has a > > > > chance to see the new date value, so the new value is never saved. > > > > > What I need is a way to tell Lift to wait until after my parser has > > > > had a chance to write the changed value. > > > > > I like the ajax style, so I don't want to make a 'submit' form, and > > > > 'onchange' won't do it either, because the value is actually changed > > > > twice (once to a formatted date, once to millis). > > > > > What I need is some way to say, 'OK to start ajax now'! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
