lol I don't think it's anything like the example I provided for you. I
personally think your forcing the client to do a whole lot of unnecessary
work. I don't understand the purpose of using keyup, change etc unless you
expect to see real time change. Your original question stated you wanted to
get those values into the confirm which happens on click. Why your doing
what your doing is beyond me.

Anyhow there is lots of documentation in regards to this. You are using
tapestry-jquery which is a third party library unrelated to the tapestry
core. Up until 5.4 tapestry was built with prototype, so you will need to
look past the js while looking at the examples below.

http://tapestry.apache.org/component-mixins.html
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained

And of course you always have github to look at example implementations.
https://github.com/apache/tapestry-5/tree/5.3/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins

I'm not sure how far into your project you are, but you should consider 5.4
if you plan on using jquery. There is much better internal support for it
than 3.7 and does not require tapestry-jquery to function.

5.4 github examples with jquery.
https://github.com/apache/tapestry-5/tree/5.4-beta-22/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins

On Sun, Oct 19, 2014 at 6:16 PM, Name Surname <wintertime0...@outlook.com>
wrote:

> Hey George! This is exactly almost same as I have done in JQuery.
>
>  $("input")
>                         .keyup(function() {
>                     var value = $(broj).val();
>                     $("#provjeraBroj").text(value);
>                     var value = $(datum).val();
>                     $("#provjeraDatum").text(value);
>                     //var value = $(drawTip).val();
>
>                     $('#drawTip').change(function() {
>                         var $selected = $(this).find('option:selected');
>                         if ($selected.val() === 'LOT_NAC') {
>                             $("#provjeraDrawTip").text("Loteri");
>                         }
>                         if ($selected.val() === 'CHANCES') {
>                             $("#provjeraDrawTip").text("Chances");
>                         }
>                         else {
>                             $("#provjeraDrawTip").text("NavideƱa");
>
>                         }
>                     }).change();
>
>
>                     var value = $(series).val();
>                     $("#provjeraSeries").text(value);
>                     var value = $(brojTiketa).val();
>                     $("#provjeraBrojTiketa").text(value);
>                 })
>                         .keyup();
>
>
> This is what I needed all the time, to see how Tap5 listens for JS calls!
> I couldn't figure it out from the examples you have posted, because it
> wasn't very clear to me how it is being called and where! This is a great
> value to me now and this should be put into JS example on Tap5 official
> page( It lacks so much full understanding introduction about this and many
> other topics )! Once again, thank you on your effort!!! :))
>
> > Date: Sun, 19 Oct 2014 14:50:32 -0400
> > Subject: Re: Calling property in t:message
> > From: gchrist...@cardaddy.com
> > To: users@tapestry.apache.org
> >
> > This should get you close. fyi, I wrote this in the email client and
> > has not been tested.
> >
> >
> > //This can be made much more dynamic by passing in a json object
> > rather than using fieldId1, fieldId2 etc. however I'm just
> > demonstrating
> > //how you can pass these values into your mixin.
> > <t:submit t:mixins="confirm" t:message="yourMessage"
> > t:fieldId1="literal:broj" t:fieldId2="literal:datum">Delete
> > item</t:actionlink>
> >
> >
> > Create this mixin and add it to your java mixins package.
> >
> > @Import(library = "context:js/confirm.js")
> > public class Confirm {
> >
> >       @Parameter(defaultPrefix = BindingConstants.LITERAL)
> >       private String fieldId1;
> >
> >       @Parameter(defaultPrefix = BindingConstants.LITERAL)
> >       private String fieldId2;
> >
> >
> > @Parameter(value = "Are you sure?", defaultPrefix =
> BindingConstants.LITERAL
> > )
> > private String message;
> >
> > @Inject
> > private JavaScriptSupport js;
> >
> > @InjectContainer
> > private ClientElement element;
> >
> > /**
> > * Add script.
> > */
> > @AfterRender
> > public void afterRender() {
> > js.addInitializerCall("confirmation", new JSONObject("id", this.element.
> > getClientId(), "message", this.message, "fieldId1", this.fieldId1,
> > "fieldId2", this.fieldId2));
> > }
> > }
> >
> >
> > Add the following code to a file called confirm.js and add it to your
> > js package. js/confirm.js
> >
> > (function ($){
> > T5.extendInitializers(function(){
> > function confirmation(spec){
> > $("#"+spec.id).bind("click", function(e){
> >
> > //This reads the field values. Id's may be a bit dangerous if your doing
> > something
> > //where tapestry may dynamically generate them. 5.4 contributes custom
> > attributes
> > //for validation rather than id's which will address the issue of dynamic
> > id generation.
> > var field1 = $("#" + spec.fieldId1).val();
> > var field2 = $("#" + spec.fieldId2).val();
> >
> > //you will need to create some business logic to handle empty values.
> >
> > //Generate message example
> > var message = spec.message + " " + field1 + " " + field2;
> >
> > if(!confirm(message))
> > e.preventDefault();
> > });
> > }
> > return { confirmation : confirmation}
> > });
> > }) (jQuery);
> >
> >
> > On Sun, Oct 19, 2014 at 2:20 PM, George Christman <
> gchrist...@cardaddy.com>
> > wrote:
> >
> > > there is no code posted
> > >
> > > On Sun, Oct 19, 2014 at 2:14 PM, Name Surname <
> wintertime0...@outlook.com>
> > > wrote:
> > >
> > >> I made a jquery script that listens for change on every single field.
> It
> > >> produces exactly what I wanted, but that's not what I needed. I
> wanted to
> > >> implement it using Tap for better understanding how Tap deals with JS.
> > >> Anyway, here is a code for it:
> > >>
> > >>
> > >>
> > >>             Crear  Fracciones
> > >>             Para el sorteo:
> > >>             Fecha:
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> Confirmar
> > >>
> > >>
> > >
> > >
> > >
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> > >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
>
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to