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
                                          

Reply via email to