Hello, I have a AjaxFormLoop that contains several fields. When a new row has
been added, I need to check the db to see if any of the fields within that
row need are required. If any of the fields comes back true, I need to put
the fields into a hashset then pass them to my script where I would use the
script to add Asterisk to the field. This all works fine on render, just not
after the page has loaded and this is only do to the fact AjaxFormLoop
doesn't call afterRender.  Any thoughts on how to do this? Thanks

Current code. 

    private Set<String> fieldIds = new HashSet<String>();

    public FieldValidator getFieldDisabled(Field field) {
        this.requiredFieldAsterisk(field);        
        return this.purchaseRequestValidation.FieldValidator(field,
this.formValidations, this.action);
    }

    //Fields 
    public void requiredFieldAsterisk(Field field) {

       //FormValidations is just a list of all the fields contained within
the database that are required 
       //within this a particular state of the form. 
       for(FormValidation formValidation : this.formValidations) {
           
if(field.getControlName().startsWith(formValidation.getFormField().getDbTableField()))
{
                this.fieldIds.add(field.getControlName());
            }
        } 
    }

//Jquery

function requiredFields(val) {     
    $.each(val, function(index, item) {
        $('label[for=' + item.id + ']').before('*');
    })
}

   void afterRender() {
        js.addScript("requiredFields(%s)", this.fieldIds);
    }



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/passing-values-into-script-after-ajaxformloop-row-has-been-added-tp5716762.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to