You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dick_hu <di...@gmail.com> on 2011/09/08 04:06:17 UTC

Form validate on submit event

tapesty has it's own submit way.
Now I want do  some validate when I click the submit button
Is there any easy way to do it.

Can AnyOne help me solve this problem,thanks a lot.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Form-validate-on-submit-event-tp4780855p4780855.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Form validate on submit event

Posted by Yohan Yudanara <yo...@gmail.com>.
Thanks for notifying me.
I haven't knew it before...

On Thu, Sep 8, 2011 at 1:55 PM, Steve Eynon
<st...@alienfactory.co.uk>wrote:

> void onValidateForm()
>
> is deprecated in T5.2 and has been removed in T5.3, best to use
>
> onValidateFromForm()
>
> instead. I mention it 'cos I got bit by it upgrading some apps from
> T5.1 to T5.3.
>
> Steve.
>
>

Re: Form validate on submit event

Posted by Taha Hafeez <ta...@gmail.com>.
To elaborate on what Steve said, in onValidateFromForm(), 'form'
stands for the component id of the form, so for

<form t:type='form' t:id='myForm'>
</form>

the validate event handler for form will be

onValidateFromMyForm()


On Thu, Sep 8, 2011 at 12:25 PM, Steve Eynon
<st...@alienfactory.co.uk> wrote:
> void onValidateForm()
>
> is deprecated in T5.2 and has been removed in T5.3, best to use
>
> onValidateFromForm()
>
> instead. I mention it 'cos I got bit by it upgrading some apps from
> T5.1 to T5.3.
>
> Steve.
>
>
> On 8 September 2011 10:54, dick_hu <di...@gmail.com> wrote:
>>
>> Yohan Yudanara-2 wrote:
>>>
>>> server side or client-side validation?
>>>
>>> client-side validation,but not in tapestry
>>>
>>> If client side, then you can create regular <input type="button"
>>> onClick="blablabla()"> on .tml file.
>>> On blablabla() method you do the client-side validation and then submit
>>> the
>>> form.
>>>
>>> just submit the form in my way,like document.forms[0].submit ?
>>> this way can any other validation trigger?
>>>
>>> Is tapestry has it's own submit way?
>>>
>>
>>
>> --
>> View this message in context: http://tapestry.1045711.n5.nabble.com/Form-validate-on-submit-event-tp4780855p4780950.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Regards

Taha Hafeez Siddiqi (tawus)
http://tawus.wordpress.com

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


Re: Form validate on submit event

Posted by Steve Eynon <st...@alienfactory.co.uk>.
void onValidateForm()

is deprecated in T5.2 and has been removed in T5.3, best to use

onValidateFromForm()

instead. I mention it 'cos I got bit by it upgrading some apps from
T5.1 to T5.3.

Steve.


On 8 September 2011 10:54, dick_hu <di...@gmail.com> wrote:
>
> Yohan Yudanara-2 wrote:
>>
>> server side or client-side validation?
>>
>> client-side validation,but not in tapestry
>>
>> If client side, then you can create regular <input type="button"
>> onClick="blablabla()"> on .tml file.
>> On blablabla() method you do the client-side validation and then submit
>> the
>> form.
>>
>> just submit the form in my way,like document.forms[0].submit ?
>> this way can any other validation trigger?
>>
>> Is tapestry has it's own submit way?
>>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Form-validate-on-submit-event-tp4780855p4780950.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: Form validate on submit event

Posted by Yohan Yudanara <yo...@gmail.com>.
Yes, you can use document.forms[0].submit.

Tapestry submit component behaviour is normal like plain HTML submit.

If you want to add additional javascript validation before submit, you can
do something like this:

<script type="text/javascript">
       // if this function return true then submit is executed
       function additionalValidation() {
  if ($('testField').value == 'yohan') {
return true;
  }
  return false;
}
</script>

<t:form t:id="form">
    <t:textfield t:id="testField" t:value="testField" t:validate="required"
/>
    <t:submit t:id="normalSubmit" value="submit" onclick="return
additionalValidation();"/>
</t:form>
</html>


On Thu, Sep 8, 2011 at 9:54 AM, dick_hu <di...@gmail.com> wrote:

> >
> > just submit the form in my way,like document.forms[0].submit ?
> > this way can any other validation trigger?
> >
> > Is tapestry has it's own submit way?
> >
>
>
>

Re: Form validate on submit event

Posted by dick_hu <di...@gmail.com>.
Yohan Yudanara-2 wrote:
> 
> server side or client-side validation?
> 
> client-side validation,but not in tapestry
> 
> If client side, then you can create regular <input type="button"
> onClick="blablabla()"> on .tml file.
> On blablabla() method you do the client-side validation and then submit
> the
> form.
> 
> just submit the form in my way,like document.forms[0].submit ?
> this way can any other validation trigger?
> 
> Is tapestry has it's own submit way?
> 


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Form-validate-on-submit-event-tp4780855p4780950.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: Form validate on submit event

Posted by Yohan Yudanara <yo...@gmail.com>.
server side or client-side validation?

If server side, then you just need to create onValidateForm() method in your
page class.

If client side, then you can create regular <input type="button"
onClick="blablabla()"> on .tml file.
On blablabla() method you do the client-side validation and then submit the
form.

FYI, Tapestry already has many client-side validation.

On Thu, Sep 8, 2011 at 9:06 AM, dick_hu <di...@gmail.com> wrote:

> tapesty has it's own submit way.
> Now I want do  some validate when I click the submit button
> Is there any easy way to do it.
>
> Can AnyOne help me solve this problem,thanks a lot.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Form-validate-on-submit-event-tp4780855p4780855.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>