You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yohan Yudanara <yo...@gmail.com> on 2011/09/06 06:13:14 UTC

"cancel" mode of submit component is not submit to server

Hi..

I want to use submit button which can bypass client validation.
Having read this documentation:
http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html,
I was trying to use Submit component with mode="cancel" like this:

<t:form t:id="form">
        <t:textfield t:id="testField" t:value="testField"
t:validate="required" />
        <t:submit value="normal submit"/>
        <t:submit mode="cancel" value="cancel submit"/>
</t:form>

But, when I click "cancel submit", nothing happen (form is not submitted to
server).
If I click "normal submit" after "cancel submit", the form is submitted to
server without client validation.

Why do I should click two buttons ( "cancel"  and then "normal" submit) to
bypass client validation?
Is it a bug?
"Cancel submit" supposed to directly submit form to server, isn't it?
Is there a simple workaround for this?

Thanks in advance,

Best regards,
Yohan Yudanara

Re: "cancel" mode of submit component is not submit to server

Posted by Taha Hafeez <ta...@gmail.com>.
Hi Yohan,

I prefer to use my own cancel button(using get instead of post)
inspired(read copied/cheated/learnt) from the chenillekit's button.

@Import(library = "cancel-form.js")
public class Cancel implements ClientElement
{
   /**
    * JavaScript id to be used. If id is not supplied, it will be auto-generated
    */
   @Parameter(value = "prop:componentResources.id", defaultPrefix =
BindingConstants.LITERAL)
   private String clientId;

   /**
    * Text to be displayed on the button. It is used at the content of the
    * &lt;button&gt; tag
    */
   @Parameter(value = "Cancel", defaultPrefix =
BindingConstants.LITERAL, required = true, allowNull = false)
   private String value;

   /**
    * Zone to update
    */
   @Parameter(defaultPrefix = BindingConstants.LITERAL)
   private String zone;

   @Inject
   private ComponentResources componentResources;

   @Inject
   private JavaScriptSupport javaScriptSupport;

   private String assignedClientId;

   @Parameter
   private Object[] context;

   public String getClientId()
   {
      return assignedClientId;
   }

   void setupRender()
   {
      assignedClientId = javaScriptSupport.allocateClientId(clientId);
   }

   boolean beginRender(MarkupWriter writer)
   {
      writer.element("button", "type", "button", "id", getClientId());
      writer.write(value);
      writer.end();

      addJavaScript();

      return false;
   }

   private void addJavaScript()
   {
      JSONObject params = new JSONObject();
      params.put("zone", zone);
      params.put("elementId", getClientId());
      params.put("url", getCancelURL());
      javaScriptSupport.addInitializerCall("cancelForm", params);
   }

   private String getCancelURL()
   {
      return componentResources.createEventLink("cancel",
context).toAbsoluteURI();
   }

}

Tapestry.Initializer.cancelForm = function(params)
{
   var element = $(params.elementId);

   Event.observe(element, "click", function(event)
   {
      event.preventDefault();
      var form = $(element).up("form");

      if($T(form).zoneId)
      {
         var zoneManager = Tapestry.findZoneManager(form);
         if(zoneManager != null)
         {
            zoneManager.updateFromURL(params.url);
            return;
         }
      }

      // Not within a form
      window.location.href = params.url;

   });
};

Tapestry.Initializer.cancelForm = function(params)
{
   var element = $(params.elementId);

   Event.observe(element, "click", function(event)
   {
      event.preventDefault();
      var form = $(element).up("form");

      if($T(form).zoneId)
      {
         var zoneManager = Tapestry.findZoneManager(form);
         if(zoneManager != null)
         {
            zoneManager.updateFromURL(params.url);
            return;
         }
      }

      // Not within a form
      window.location.href = params.url;

   });
};

Hope it helps


On Tue, Sep 6, 2011 at 10:30 AM, Steve Eynon
<st...@alienfactory.co.uk> wrote:
> Yay! I'm happy I'm not the only one who's noticed this!
>
> [T5.3-beta-1] Submit buttons with t:mode="cancel" do not submit the form
> http://tapestry.markmail.org/message/5yrkjtm2nfevear5
>
> I to, would like someone in the know to confirm whether this is
> desired behaviour (I'm thinking it's not, but then again, I'm also
> pretty stoopid).
>
> But, err, I don't know what the workaround is.
>
> For those who want the "Canceled" event to fire in T5.3, remove the
> t:mode="cancel" attribute (so the form submits!), ensure your cancel
> button has t:id="cancel" and add the following to your Module:
>
> public static void
> contributeFactoryDefaults(MappedConfiguration<String, Object>
> configuration) {
>        // remove "cancel" from the list of reserved names
>        configuration.override(InternalSymbols.PRE_SELECTED_FORM_NAMES,
> "reset,submit,select,id,method,action,onsubmit");
> }
>
> The downside being you can now only have one Cancel button per form
> and, as in T5.2.6, you either have to turn off client side validation
> for the whole form:
>
> <t:form t:clientValidation="false" ...
>
> or for the whole application:
>
> public static void
> contributeApplicationDefaults(MappedConfiguration<String, String>
> configuration) {
>        configuration.add(SymbolConstants.FORM_CLIENT_LOGIC_ENABLED, "false");
> }
>
> Steve.
>
>
> On 6 September 2011 12:15, Yohan Yudanara <yo...@gmail.com> wrote:
>> oo sorry, I forgot to mention.
>> I'm using Tapestry 5.2.6
>>
>> On Tue, Sep 6, 2011 at 11:13 AM, Yohan Yudanara <yo...@gmail.com>wrote:
>>
>>> Hi..
>>>
>>> I want to use submit button which can bypass client validation.
>>> Having read this documentation:
>>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html,
>>> I was trying to use Submit component with mode="cancel" like this:
>>>
>>> <t:form t:id="form">
>>>         <t:textfield t:id="testField" t:value="testField"
>>> t:validate="required" />
>>>         <t:submit value="normal submit"/>
>>>         <t:submit mode="cancel" value="cancel submit"/>
>>> </t:form>
>>>
>>> But, when I click "cancel submit", nothing happen (form is not submitted to
>>> server).
>>> If I click "normal submit" after "cancel submit", the form is submitted to
>>> server without client validation.
>>>
>>> Why do I should click two buttons ( "cancel"  and then "normal" submit) to
>>> bypass client validation?
>>> Is it a bug?
>>> "Cancel submit" supposed to directly submit form to server, isn't it?
>>> Is there a simple workaround for this?
>>>
>>> Thanks in advance,
>>>
>>> Best regards,
>>> Yohan Yudanara
>>>
>>
>
> ---------------------------------------------------------------------
> 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: "cancel" mode of submit component is not submit to server

Posted by Steve Eynon <st...@alienfactory.co.uk>.
Yay! I'm happy I'm not the only one who's noticed this!

[T5.3-beta-1] Submit buttons with t:mode="cancel" do not submit the form
http://tapestry.markmail.org/message/5yrkjtm2nfevear5

I to, would like someone in the know to confirm whether this is
desired behaviour (I'm thinking it's not, but then again, I'm also
pretty stoopid).

But, err, I don't know what the workaround is.

For those who want the "Canceled" event to fire in T5.3, remove the
t:mode="cancel" attribute (so the form submits!), ensure your cancel
button has t:id="cancel" and add the following to your Module:

public static void
contributeFactoryDefaults(MappedConfiguration<String, Object>
configuration) {
	// remove "cancel" from the list of reserved names
	configuration.override(InternalSymbols.PRE_SELECTED_FORM_NAMES,
"reset,submit,select,id,method,action,onsubmit");
}

The downside being you can now only have one Cancel button per form
and, as in T5.2.6, you either have to turn off client side validation
for the whole form:

<t:form t:clientValidation="false" ...

or for the whole application:

public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
configuration) {
	configuration.add(SymbolConstants.FORM_CLIENT_LOGIC_ENABLED, "false");
}

Steve.


On 6 September 2011 12:15, Yohan Yudanara <yo...@gmail.com> wrote:
> oo sorry, I forgot to mention.
> I'm using Tapestry 5.2.6
>
> On Tue, Sep 6, 2011 at 11:13 AM, Yohan Yudanara <yo...@gmail.com>wrote:
>
>> Hi..
>>
>> I want to use submit button which can bypass client validation.
>> Having read this documentation:
>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html,
>> I was trying to use Submit component with mode="cancel" like this:
>>
>> <t:form t:id="form">
>>         <t:textfield t:id="testField" t:value="testField"
>> t:validate="required" />
>>         <t:submit value="normal submit"/>
>>         <t:submit mode="cancel" value="cancel submit"/>
>> </t:form>
>>
>> But, when I click "cancel submit", nothing happen (form is not submitted to
>> server).
>> If I click "normal submit" after "cancel submit", the form is submitted to
>> server without client validation.
>>
>> Why do I should click two buttons ( "cancel"  and then "normal" submit) to
>> bypass client validation?
>> Is it a bug?
>> "Cancel submit" supposed to directly submit form to server, isn't it?
>> Is there a simple workaround for this?
>>
>> Thanks in advance,
>>
>> Best regards,
>> Yohan Yudanara
>>
>

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


Re: "cancel" mode of submit component is not submit to server

Posted by Yohan Yudanara <yo...@gmail.com>.
oo sorry, I forgot to mention.
I'm using Tapestry 5.2.6

On Tue, Sep 6, 2011 at 11:13 AM, Yohan Yudanara <yo...@gmail.com>wrote:

> Hi..
>
> I want to use submit button which can bypass client validation.
> Having read this documentation:
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html,
> I was trying to use Submit component with mode="cancel" like this:
>
> <t:form t:id="form">
>         <t:textfield t:id="testField" t:value="testField"
> t:validate="required" />
>         <t:submit value="normal submit"/>
>         <t:submit mode="cancel" value="cancel submit"/>
> </t:form>
>
> But, when I click "cancel submit", nothing happen (form is not submitted to
> server).
> If I click "normal submit" after "cancel submit", the form is submitted to
> server without client validation.
>
> Why do I should click two buttons ( "cancel"  and then "normal" submit) to
> bypass client validation?
> Is it a bug?
> "Cancel submit" supposed to directly submit form to server, isn't it?
> Is there a simple workaround for this?
>
> Thanks in advance,
>
> Best regards,
> Yohan Yudanara
>

Re: "cancel" mode of submit component is not submit to server

Posted by Steve Eynon <st...@alienfactory.co.uk>.
A nice idea, I figure everyone builds up their own mini-library of T5 add-ons!

As for the above, I've just added an 'event' and 'disabled' parameters
and re-named it to 'EventButton'.

Steve.

On 7 September 2011 11:02, Taha Hafeez <ta...@gmail.com> wrote:
> Hi Steve
>
> Thanks for pointing it out. Well I will remove the zone and add it to
> tawus-addons library. We should have something like
> tapestry-extensions containing all these extensions that are not
> important enough to be in core but good enough to be the the project
>
>
> On Wed, Sep 7, 2011 at 8:13 AM, Steve Eynon
> <st...@alienfactory.co.uk> wrote:
>> form.submit vs form.submit() - I can't believe I was diddled by that
>> old chestnut! I've pointed it out to many others in the past!
>>
>> I knew it must have been something glaringly obvious and a mistake on
>> mybehalf - it was too blatant to just flat out not work!
>>
>>> I've created https://issues.apache.org/jira/browse/TAP5-1632
>>
>> Ach, cheers you beat me to it!
>>
>> And Taha, that Cancel button is a great idea - it can also be used as
>> more generic "LinkButton" component - it doesn't need to be anything
>> specific to Cancel (e.g. I've just used it as a "Delete" button)
>>
>> For others who may be taken to cut'n'paste, note the Zone @Parameter
>> is defunc as it's not used in the JavaScript. But if nested within an
>> Ajax form, the JS does update the Zone param of the form.
>>
>> Cheers,
>>
>> Steve.
>>
>> On 7 September 2011 10:14, Yohan Yudanara <yo...@gmail.com> wrote:
>>> I've created https://issues.apache.org/jira/browse/TAP5-1632 for this
>>> defect.
>>>
>>> Thanks..
>>>
>>> On Wed, Sep 7, 2011 at 3:36 AM, Josh Canfield <jo...@gmail.com>wrote:
>>>
>>>> > If we want to use "cancel" mode submit, then we should give an id to the
>>>> submit component.
>>>>
>>>> This is a defect for sure. Submit should never create an id of submit.
>>>> There was something filed at one point, but I haven't taken the time
>>>> to track it down. If you want to file a new defect we can probably get
>>>> it sorted before 5.3 is released.
>>>>
>>>> Thanks,
>>>> Josh
>>>>
>>>>
>>>> On Tue, Sep 6, 2011 at 7:27 AM, Yohan Yudanara <yo...@gmail.com>
>>>> wrote:
>>>> > Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping
>>>> me
>>>> > find a workaround.
>>>> >
>>>> > And many thanks to Josh Canfield who can point directly about mistake in
>>>> my
>>>> > code. Yep, it's because my submit don't have id.
>>>> >
>>>> > So the conclusion is: If we want to use "cancel" mode submit, then we
>>>> should
>>>> > give an id to the submit component.
>>>> > "cancel" mode is working after I change my template code to this:
>>>> > <t:form t:id="form">
>>>> >        <t:textfield t:id="testField" t:value="testField"
>>>> > t:validate="required" />
>>>> >        <t:submit t:id="normalSubmit" value="normal submit"/>
>>>> >        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel
>>>> submit"/>
>>>> > </t:form>
>>>> >
>>>> > Thanks a lot for your help, guys..
>>>> > You save my time a lot..
>>>> >
>>>> >
>>>> > On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <joshcanfield@gmail.com
>>>> >wrote:
>>>> >
>>>> >> I believe the problem is that the id of your submit button is "submit"
>>>> >> which
>>>> >> overrides the form. submit() of the form. Try adding t:id="something" to
>>>> >> your submit button.
>>>> >>
>>>> >> I thought this was fixed, but just team into it myself last week.
>>>> >> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com>
>>>> wrote:
>>>> >> > Hi..
>>>> >> >
>>>> >> > I want to use submit button which can bypass client validation.
>>>> >> > Having read this documentation:
>>>> >> >
>>>> >>
>>>> >>
>>>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
>>>> >> ,
>>>> >> > I was trying to use Submit component with mode="cancel" like this:
>>>> >> >
>>>> >> > <t:form t:id="form">
>>>> >> > <t:textfield t:id="testField" t:value="testField"
>>>> >> > t:validate="required" />
>>>> >> > <t:submit value="normal submit"/>
>>>> >> > <t:submit mode="cancel" value="cancel submit"/>
>>>> >> > </t:form>
>>>> >> >
>>>> >> > But, when I click "cancel submit", nothing happen (form is not
>>>> submitted
>>>> >> to
>>>> >> > server).
>>>> >> > If I click "normal submit" after "cancel submit", the form is
>>>> submitted
>>>> >> to
>>>> >> > server without client validation.
>>>> >> >
>>>> >> > Why do I should click two buttons ( "cancel" and then "normal" submit)
>>>> to
>>>> >> > bypass client validation?
>>>> >> > Is it a bug?
>>>> >> > "Cancel submit" supposed to directly submit form to server, isn't it?
>>>> >> > Is there a simple workaround for this?
>>>> >> >
>>>> >> > Thanks in advance,
>>>> >> >
>>>> >> > Best regards,
>>>> >> > Yohan Yudanara
>>>> >>
>>>> >
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>
>

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


Re: "cancel" mode of submit component is not submit to server

Posted by Taha Hafeez <ta...@gmail.com>.
Hi Steve

Thanks for pointing it out. Well I will remove the zone and add it to
tawus-addons library. We should have something like
tapestry-extensions containing all these extensions that are not
important enough to be in core but good enough to be the the project


On Wed, Sep 7, 2011 at 8:13 AM, Steve Eynon
<st...@alienfactory.co.uk> wrote:
> form.submit vs form.submit() - I can't believe I was diddled by that
> old chestnut! I've pointed it out to many others in the past!
>
> I knew it must have been something glaringly obvious and a mistake on
> mybehalf - it was too blatant to just flat out not work!
>
>> I've created https://issues.apache.org/jira/browse/TAP5-1632
>
> Ach, cheers you beat me to it!
>
> And Taha, that Cancel button is a great idea - it can also be used as
> more generic "LinkButton" component - it doesn't need to be anything
> specific to Cancel (e.g. I've just used it as a "Delete" button)
>
> For others who may be taken to cut'n'paste, note the Zone @Parameter
> is defunc as it's not used in the JavaScript. But if nested within an
> Ajax form, the JS does update the Zone param of the form.
>
> Cheers,
>
> Steve.
>
> On 7 September 2011 10:14, Yohan Yudanara <yo...@gmail.com> wrote:
>> I've created https://issues.apache.org/jira/browse/TAP5-1632 for this
>> defect.
>>
>> Thanks..
>>
>> On Wed, Sep 7, 2011 at 3:36 AM, Josh Canfield <jo...@gmail.com>wrote:
>>
>>> > If we want to use "cancel" mode submit, then we should give an id to the
>>> submit component.
>>>
>>> This is a defect for sure. Submit should never create an id of submit.
>>> There was something filed at one point, but I haven't taken the time
>>> to track it down. If you want to file a new defect we can probably get
>>> it sorted before 5.3 is released.
>>>
>>> Thanks,
>>> Josh
>>>
>>>
>>> On Tue, Sep 6, 2011 at 7:27 AM, Yohan Yudanara <yo...@gmail.com>
>>> wrote:
>>> > Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping
>>> me
>>> > find a workaround.
>>> >
>>> > And many thanks to Josh Canfield who can point directly about mistake in
>>> my
>>> > code. Yep, it's because my submit don't have id.
>>> >
>>> > So the conclusion is: If we want to use "cancel" mode submit, then we
>>> should
>>> > give an id to the submit component.
>>> > "cancel" mode is working after I change my template code to this:
>>> > <t:form t:id="form">
>>> >        <t:textfield t:id="testField" t:value="testField"
>>> > t:validate="required" />
>>> >        <t:submit t:id="normalSubmit" value="normal submit"/>
>>> >        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel
>>> submit"/>
>>> > </t:form>
>>> >
>>> > Thanks a lot for your help, guys..
>>> > You save my time a lot..
>>> >
>>> >
>>> > On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <joshcanfield@gmail.com
>>> >wrote:
>>> >
>>> >> I believe the problem is that the id of your submit button is "submit"
>>> >> which
>>> >> overrides the form. submit() of the form. Try adding t:id="something" to
>>> >> your submit button.
>>> >>
>>> >> I thought this was fixed, but just team into it myself last week.
>>> >> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com>
>>> wrote:
>>> >> > Hi..
>>> >> >
>>> >> > I want to use submit button which can bypass client validation.
>>> >> > Having read this documentation:
>>> >> >
>>> >>
>>> >>
>>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
>>> >> ,
>>> >> > I was trying to use Submit component with mode="cancel" like this:
>>> >> >
>>> >> > <t:form t:id="form">
>>> >> > <t:textfield t:id="testField" t:value="testField"
>>> >> > t:validate="required" />
>>> >> > <t:submit value="normal submit"/>
>>> >> > <t:submit mode="cancel" value="cancel submit"/>
>>> >> > </t:form>
>>> >> >
>>> >> > But, when I click "cancel submit", nothing happen (form is not
>>> submitted
>>> >> to
>>> >> > server).
>>> >> > If I click "normal submit" after "cancel submit", the form is
>>> submitted
>>> >> to
>>> >> > server without client validation.
>>> >> >
>>> >> > Why do I should click two buttons ( "cancel" and then "normal" submit)
>>> to
>>> >> > bypass client validation?
>>> >> > Is it a bug?
>>> >> > "Cancel submit" supposed to directly submit form to server, isn't it?
>>> >> > Is there a simple workaround for this?
>>> >> >
>>> >> > Thanks in advance,
>>> >> >
>>> >> > Best regards,
>>> >> > Yohan Yudanara
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> 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: "cancel" mode of submit component is not submit to server

Posted by Steve Eynon <st...@alienfactory.co.uk>.
form.submit vs form.submit() - I can't believe I was diddled by that
old chestnut! I've pointed it out to many others in the past!

I knew it must have been something glaringly obvious and a mistake on
mybehalf - it was too blatant to just flat out not work!

> I've created https://issues.apache.org/jira/browse/TAP5-1632

Ach, cheers you beat me to it!

And Taha, that Cancel button is a great idea - it can also be used as
more generic "LinkButton" component - it doesn't need to be anything
specific to Cancel (e.g. I've just used it as a "Delete" button)

For others who may be taken to cut'n'paste, note the Zone @Parameter
is defunc as it's not used in the JavaScript. But if nested within an
Ajax form, the JS does update the Zone param of the form.

Cheers,

Steve.

On 7 September 2011 10:14, Yohan Yudanara <yo...@gmail.com> wrote:
> I've created https://issues.apache.org/jira/browse/TAP5-1632 for this
> defect.
>
> Thanks..
>
> On Wed, Sep 7, 2011 at 3:36 AM, Josh Canfield <jo...@gmail.com>wrote:
>
>> > If we want to use "cancel" mode submit, then we should give an id to the
>> submit component.
>>
>> This is a defect for sure. Submit should never create an id of submit.
>> There was something filed at one point, but I haven't taken the time
>> to track it down. If you want to file a new defect we can probably get
>> it sorted before 5.3 is released.
>>
>> Thanks,
>> Josh
>>
>>
>> On Tue, Sep 6, 2011 at 7:27 AM, Yohan Yudanara <yo...@gmail.com>
>> wrote:
>> > Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping
>> me
>> > find a workaround.
>> >
>> > And many thanks to Josh Canfield who can point directly about mistake in
>> my
>> > code. Yep, it's because my submit don't have id.
>> >
>> > So the conclusion is: If we want to use "cancel" mode submit, then we
>> should
>> > give an id to the submit component.
>> > "cancel" mode is working after I change my template code to this:
>> > <t:form t:id="form">
>> >        <t:textfield t:id="testField" t:value="testField"
>> > t:validate="required" />
>> >        <t:submit t:id="normalSubmit" value="normal submit"/>
>> >        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel
>> submit"/>
>> > </t:form>
>> >
>> > Thanks a lot for your help, guys..
>> > You save my time a lot..
>> >
>> >
>> > On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <joshcanfield@gmail.com
>> >wrote:
>> >
>> >> I believe the problem is that the id of your submit button is "submit"
>> >> which
>> >> overrides the form. submit() of the form. Try adding t:id="something" to
>> >> your submit button.
>> >>
>> >> I thought this was fixed, but just team into it myself last week.
>> >> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com>
>> wrote:
>> >> > Hi..
>> >> >
>> >> > I want to use submit button which can bypass client validation.
>> >> > Having read this documentation:
>> >> >
>> >>
>> >>
>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
>> >> ,
>> >> > I was trying to use Submit component with mode="cancel" like this:
>> >> >
>> >> > <t:form t:id="form">
>> >> > <t:textfield t:id="testField" t:value="testField"
>> >> > t:validate="required" />
>> >> > <t:submit value="normal submit"/>
>> >> > <t:submit mode="cancel" value="cancel submit"/>
>> >> > </t:form>
>> >> >
>> >> > But, when I click "cancel submit", nothing happen (form is not
>> submitted
>> >> to
>> >> > server).
>> >> > If I click "normal submit" after "cancel submit", the form is
>> submitted
>> >> to
>> >> > server without client validation.
>> >> >
>> >> > Why do I should click two buttons ( "cancel" and then "normal" submit)
>> to
>> >> > bypass client validation?
>> >> > Is it a bug?
>> >> > "Cancel submit" supposed to directly submit form to server, isn't it?
>> >> > Is there a simple workaround for this?
>> >> >
>> >> > Thanks in advance,
>> >> >
>> >> > Best regards,
>> >> > Yohan Yudanara
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> 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: "cancel" mode of submit component is not submit to server

Posted by Yohan Yudanara <yo...@gmail.com>.
I've created https://issues.apache.org/jira/browse/TAP5-1632 for this
defect.

Thanks..

On Wed, Sep 7, 2011 at 3:36 AM, Josh Canfield <jo...@gmail.com>wrote:

> > If we want to use "cancel" mode submit, then we should give an id to the
> submit component.
>
> This is a defect for sure. Submit should never create an id of submit.
> There was something filed at one point, but I haven't taken the time
> to track it down. If you want to file a new defect we can probably get
> it sorted before 5.3 is released.
>
> Thanks,
> Josh
>
>
> On Tue, Sep 6, 2011 at 7:27 AM, Yohan Yudanara <yo...@gmail.com>
> wrote:
> > Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping
> me
> > find a workaround.
> >
> > And many thanks to Josh Canfield who can point directly about mistake in
> my
> > code. Yep, it's because my submit don't have id.
> >
> > So the conclusion is: If we want to use "cancel" mode submit, then we
> should
> > give an id to the submit component.
> > "cancel" mode is working after I change my template code to this:
> > <t:form t:id="form">
> >        <t:textfield t:id="testField" t:value="testField"
> > t:validate="required" />
> >        <t:submit t:id="normalSubmit" value="normal submit"/>
> >        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel
> submit"/>
> > </t:form>
> >
> > Thanks a lot for your help, guys..
> > You save my time a lot..
> >
> >
> > On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <joshcanfield@gmail.com
> >wrote:
> >
> >> I believe the problem is that the id of your submit button is "submit"
> >> which
> >> overrides the form. submit() of the form. Try adding t:id="something" to
> >> your submit button.
> >>
> >> I thought this was fixed, but just team into it myself last week.
> >> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com>
> wrote:
> >> > Hi..
> >> >
> >> > I want to use submit button which can bypass client validation.
> >> > Having read this documentation:
> >> >
> >>
> >>
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
> >> ,
> >> > I was trying to use Submit component with mode="cancel" like this:
> >> >
> >> > <t:form t:id="form">
> >> > <t:textfield t:id="testField" t:value="testField"
> >> > t:validate="required" />
> >> > <t:submit value="normal submit"/>
> >> > <t:submit mode="cancel" value="cancel submit"/>
> >> > </t:form>
> >> >
> >> > But, when I click "cancel submit", nothing happen (form is not
> submitted
> >> to
> >> > server).
> >> > If I click "normal submit" after "cancel submit", the form is
> submitted
> >> to
> >> > server without client validation.
> >> >
> >> > Why do I should click two buttons ( "cancel" and then "normal" submit)
> to
> >> > bypass client validation?
> >> > Is it a bug?
> >> > "Cancel submit" supposed to directly submit form to server, isn't it?
> >> > Is there a simple workaround for this?
> >> >
> >> > Thanks in advance,
> >> >
> >> > Best regards,
> >> > Yohan Yudanara
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: "cancel" mode of submit component is not submit to server

Posted by Josh Canfield <jo...@gmail.com>.
> If we want to use "cancel" mode submit, then we should give an id to the submit component.

This is a defect for sure. Submit should never create an id of submit.
There was something filed at one point, but I haven't taken the time
to track it down. If you want to file a new defect we can probably get
it sorted before 5.3 is released.

Thanks,
Josh


On Tue, Sep 6, 2011 at 7:27 AM, Yohan Yudanara <yo...@gmail.com> wrote:
> Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping me
> find a workaround.
>
> And many thanks to Josh Canfield who can point directly about mistake in my
> code. Yep, it's because my submit don't have id.
>
> So the conclusion is: If we want to use "cancel" mode submit, then we should
> give an id to the submit component.
> "cancel" mode is working after I change my template code to this:
> <t:form t:id="form">
>        <t:textfield t:id="testField" t:value="testField"
> t:validate="required" />
>        <t:submit t:id="normalSubmit" value="normal submit"/>
>        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel submit"/>
> </t:form>
>
> Thanks a lot for your help, guys..
> You save my time a lot..
>
>
> On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <jo...@gmail.com>wrote:
>
>> I believe the problem is that the id of your submit button is "submit"
>> which
>> overrides the form. submit() of the form. Try adding t:id="something" to
>> your submit button.
>>
>> I thought this was fixed, but just team into it myself last week.
>> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com> wrote:
>> > Hi..
>> >
>> > I want to use submit button which can bypass client validation.
>> > Having read this documentation:
>> >
>>
>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
>> ,
>> > I was trying to use Submit component with mode="cancel" like this:
>> >
>> > <t:form t:id="form">
>> > <t:textfield t:id="testField" t:value="testField"
>> > t:validate="required" />
>> > <t:submit value="normal submit"/>
>> > <t:submit mode="cancel" value="cancel submit"/>
>> > </t:form>
>> >
>> > But, when I click "cancel submit", nothing happen (form is not submitted
>> to
>> > server).
>> > If I click "normal submit" after "cancel submit", the form is submitted
>> to
>> > server without client validation.
>> >
>> > Why do I should click two buttons ( "cancel" and then "normal" submit) to
>> > bypass client validation?
>> > Is it a bug?
>> > "Cancel submit" supposed to directly submit form to server, isn't it?
>> > Is there a simple workaround for this?
>> >
>> > Thanks in advance,
>> >
>> > Best regards,
>> > Yohan Yudanara
>>
>

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


Re: "cancel" mode of submit component is not submit to server

Posted by Yohan Yudanara <yo...@gmail.com>.
Many thanks to Steve Eynon and Taha Hafeez for your valuable time helping me
find a workaround.

And many thanks to Josh Canfield who can point directly about mistake in my
code. Yep, it's because my submit don't have id.

So the conclusion is: If we want to use "cancel" mode submit, then we should
give an id to the submit component.
"cancel" mode is working after I change my template code to this:
<t:form t:id="form">
        <t:textfield t:id="testField" t:value="testField"
t:validate="required" />
        <t:submit t:id="normalSubmit" value="normal submit"/>
        <t:submit t:id="cancelSubmit" mode="cancel" value="cancel submit"/>
</t:form>

Thanks a lot for your help, guys..
You save my time a lot..


On Tue, Sep 6, 2011 at 8:15 PM, Josh Canfield <jo...@gmail.com>wrote:

> I believe the problem is that the id of your submit button is "submit"
> which
> overrides the form. submit() of the form. Try adding t:id="something" to
> your submit button.
>
> I thought this was fixed, but just team into it myself last week.
> On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com> wrote:
> > Hi..
> >
> > I want to use submit button which can bypass client validation.
> > Having read this documentation:
> >
>
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
> ,
> > I was trying to use Submit component with mode="cancel" like this:
> >
> > <t:form t:id="form">
> > <t:textfield t:id="testField" t:value="testField"
> > t:validate="required" />
> > <t:submit value="normal submit"/>
> > <t:submit mode="cancel" value="cancel submit"/>
> > </t:form>
> >
> > But, when I click "cancel submit", nothing happen (form is not submitted
> to
> > server).
> > If I click "normal submit" after "cancel submit", the form is submitted
> to
> > server without client validation.
> >
> > Why do I should click two buttons ( "cancel" and then "normal" submit) to
> > bypass client validation?
> > Is it a bug?
> > "Cancel submit" supposed to directly submit form to server, isn't it?
> > Is there a simple workaround for this?
> >
> > Thanks in advance,
> >
> > Best regards,
> > Yohan Yudanara
>

Re: "cancel" mode of submit component is not submit to server

Posted by Josh Canfield <jo...@gmail.com>.
I believe the problem is that the id of your submit button is "submit" which
overrides the form. submit() of the form. Try adding t:id="something" to
your submit button.

I thought this was fixed, but just team into it myself last week.
On Sep 5, 2011 9:13 PM, "Yohan Yudanara" <yo...@gmail.com> wrote:
> Hi..
>
> I want to use submit button which can bypass client validation.
> Having read this documentation:
>
http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Submit.html
,
> I was trying to use Submit component with mode="cancel" like this:
>
> <t:form t:id="form">
> <t:textfield t:id="testField" t:value="testField"
> t:validate="required" />
> <t:submit value="normal submit"/>
> <t:submit mode="cancel" value="cancel submit"/>
> </t:form>
>
> But, when I click "cancel submit", nothing happen (form is not submitted
to
> server).
> If I click "normal submit" after "cancel submit", the form is submitted to
> server without client validation.
>
> Why do I should click two buttons ( "cancel" and then "normal" submit) to
> bypass client validation?
> Is it a bug?
> "Cancel submit" supposed to directly submit form to server, isn't it?
> Is there a simple workaround for this?
>
> Thanks in advance,
>
> Best regards,
> Yohan Yudanara