You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2003/12/11 05:26:51 UTC

Client side validation using Script

I've turned on client side validation for my validators and it's working 
well enough but I have a need to provide extra javascript validation.  My 
first thought was to attach to the onsubmit handler for the form. 
Unfortunately the tapestry validation overrides this handler.  How can I 
integrate my own javascript validation logic with tapestries?

Regards,


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re[2]: Client side validation using Script

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
That's exactly it... thanks!  I'll add it to the FAQ.

At 06:29 PM 11/12/2003, you wrote:
>GS> I was thinking about that.  The only issue is that the validation I 
>want to
>GS> apply is not tied to a validatable control.  In this particular case
>GS> PropertySelection.
>
>You can add event handler during component rendering:
>
>protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle){
>     ...
>     yourFormComponent.addEventHandler(FormEventType.SUBMIT, 
> "javaScriptValidatingFunctionName");
>     ...
>}
>
>org.apache.tapestry.contrib.palette.Palette can be used for detailed
>example.
>
>--
>Denis
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/

Re[2]: Client side validation using Script

Posted by Denis Ponomarev <oz...@romsat.ua>.
GS> I was thinking about that.  The only issue is that the validation I want to
GS> apply is not tied to a validatable control.  In this particular case
GS> PropertySelection.

You can add event handler during component rendering:

protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle){
    ...
    yourFormComponent.addEventHandler(FormEventType.SUBMIT, "javaScriptValidatingFunctionName");
    ...
}

org.apache.tapestry.contrib.palette.Palette can be used for detailed
example.

-- 
Denis




















































































































































































































































































---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Client side validation using Script

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
I was thinking about that.  The only issue is that the validation I want to 
apply is not tied to a validatable control.  In this particular case 
PropertySelection.

Regards,

Glen

At 04:42 PM 11/12/2003, you wrote:
>I see now. What you could do is create a new validator and a script and 
>simply implement renderValidatorContribution(). This would add your script 
>to the submit event of the form in addition to the other validator scripts.
>
>-Harish
>
>Glen Stampoultzis wrote:
>
>>I don't think so.  I need to "fix" the way the onsubmit call is being 
>>generated.  The validator scripts don't seem to deal with this.
>>-- Glen
>>At 03:39 PM 11/12/2003, you wrote:
>>
>>>Validators have a setScriptPath method that allows one to override the 
>>>actual script used by the validator. Would that help?
>>>
>>>-Harish
>>>
>>>Glen Stampoultzis wrote:
>>>
>>>>I've turned on client side validation for my validators and it's 
>>>>working well enough but I have a need to provide extra javascript validation.
>>>>My first thought was to attach to the onsubmit handler for the form. 
>>>>Unfortunately the tapestry validation overrides this handler.  How can 
>>>>I integrate my own javascript validation logic with tapestries?
>>>>Regards,
>>>>
>>>>Glen Stampoultzis
>>>>gstamp@iinet.net.au
>>>>http://members.iinet.net.au/~gstamp/glen/
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>Glen Stampoultzis
>>gstamp@iinet.net.au
>>http://members.iinet.net.au/~gstamp/glen/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/

Re: Client side validation using Script

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I see now. What you could do is create a new validator and a script and simply implement 
renderValidatorContribution(). This would add your script to the submit event of the form in 
addition to the other validator scripts.

-Harish

Glen Stampoultzis wrote:

> 
> I don't think so.  I need to "fix" the way the onsubmit call is being 
> generated.  The validator scripts don't seem to deal with this.
> 
> -- Glen
> 
> At 03:39 PM 11/12/2003, you wrote:
> 
>> Validators have a setScriptPath method that allows one to override the 
>> actual script used by the validator. Would that help?
>>
>> -Harish
>>
>> Glen Stampoultzis wrote:
>>
>>> I've turned on client side validation for my validators and it's 
>>> working well enough but I have a need to provide extra javascript 
>>> validation.
>>> My first thought was to attach to the onsubmit handler for the form. 
>>> Unfortunately the tapestry validation overrides this handler.  How 
>>> can I integrate my own javascript validation logic with tapestries?
>>> Regards,
>>>
>>> Glen Stampoultzis
>>> gstamp@iinet.net.au
>>> http://members.iinet.net.au/~gstamp/glen/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
> 
> 
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Client side validation using Script

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
I don't think so.  I need to "fix" the way the onsubmit call is being 
generated.  The validator scripts don't seem to deal with this.

-- Glen

At 03:39 PM 11/12/2003, you wrote:
>Validators have a setScriptPath method that allows one to override the 
>actual script used by the validator. Would that help?
>
>-Harish
>
>Glen Stampoultzis wrote:
>>I've turned on client side validation for my validators and it's working 
>>well enough but I have a need to provide extra javascript validation.
>>My first thought was to attach to the onsubmit handler for the form. 
>>Unfortunately the tapestry validation overrides this handler.  How can I 
>>integrate my own javascript validation logic with tapestries?
>>Regards,
>>
>>Glen Stampoultzis
>>gstamp@iinet.net.au
>>http://members.iinet.net.au/~gstamp/glen/
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/

Re: Client side validation using Script

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Validators have a setScriptPath method that allows one to override the actual script used by the 
validator. Would that help?

-Harish

Glen Stampoultzis wrote:
> I've turned on client side validation for my validators and it's working 
> well enough but I have a need to provide extra javascript validation.  
> My first thought was to attach to the onsubmit handler for the form. 
> Unfortunately the tapestry validation overrides this handler.  How can I 
> integrate my own javascript validation logic with tapestries?
> 
> Regards,
> 
> 
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org