You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borut Bolčina <bo...@gmail.com> on 2009/08/19 13:55:52 UTC
Re: Component LinkSubmit doesn't work
Hi,
I am using T 5.0.18 and have problems with LinkSubmit not firing the event.
By the way, what is the url of T 5.0.18 and its API?
I have two TextField components, one LinkSubmit and one non-tapestry
ordinary input submit button.
I want to set some variable (varA) in case LinkSubmit is clicked, so I can
validate the TextFields differently. In case LinkSubmit is pressed only
first TextField is required and in case ordinary submit is pressed, both
TextFields are required. I want to do a simple if (based on the varA) in the
onValidate method and set the form.recordError accordingly.
BUT, the event specified in the LinkSubmit is not triggered so I can not set
the varA! Can someone please suggest a workaround or a proper solution.
Thanks,
Borut
2009/5/13 petkovf <fp...@startext.de>
>
> I'm found this problem since in 5.1.0.5 (stable), in 5.0.0.18 LinkSubmit
> work
> properly.
>
> Linksubmit inside a form didn't fire events while no required property is
> defined inside the form:
>
> if you add
>
> @Property
> @Validate("required")
> private String somefield;
>
> in java and
>
> <input t:type="TextField" t:id="somefield"/>
>
> in tml
>
> your LinkSubmit began event capture
>
> This is a huge limitation for the developers, particularly if you want to
> filter a object (entity) view this behavior doesn't help much.
>
> The issue https://issues.apache.org/jira/browse/TAP5-389 describe somthing
> similar, but not in this tapestry version (5.1.0.5) and is closed in the
> meantime.
>
> --
> View this message in context:
> http://n2.nabble.com/Component-LinkSubmit-doesn%27t-work-tp2879193p2879193.html
> Sent from the Tapestry Users 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: Component LinkSubmit doesn't work
Posted by Sergey Didenko <se...@gmail.com>.
http://tapestry.apache.org/tapestry5.0/
http://tapestry.apache.org/tapestry5.0/apidocs/
On Wed, Aug 19, 2009 at 2:55 PM, Borut Bolčina<bo...@gmail.com> wrote:
> By the way, what is the url of T 5.0.18 and its API?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Component LinkSubmit doesn't work
Posted by Borut Bolčina <bo...@gmail.com>.
Maybe with the example code someone can explain this better why the event
onSendPin is not called when LinkSubmit is clicked, but it is when the
submit button is clicked:
TML
===========================================
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<title>linksubmit Start Page</title>
</head>
<body>
<form t:type="form" t:id="form" name="lgn" class="register_user"
t:autofocus="true" t:clientValidation="false">
<t:errors/>
<li>
<label for="companyId">Company ID:</label>
<input t:type="TextField" t:id="companyId" name="companyId"
id="companyId" value="companyId" class="pinclass" size="10" maxlength="10"/>
</li>
<li>
<label for="pin">PIN code:</label>
<input t:type="TextField" t:id="pin" name="pin" id="pin"
value="pin" class="pinclass" size="10" maxlength="7"/>
</li>
<li>
<t:linksubmit t:event="sendPin">send PIN</t:linksubmit>
</li>
<input id="submit" type="submit" value="CONTINUE"/>
</form>
</body>
</html>
JAVA
===========================================
import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.slf4j.Logger;
/**
* Start page of application linksubmit.
*/
public class Index {
@Property
private String companyId;
@Property
private String pin;
@Property
@Persist(PersistenceConstants.FLASH)
private String mode;
@Inject
private Logger logger;
@Log
void onSendPin() {
mode = "sendPin";
}
void onValidateForm() {
logger.info("mode: {}", mode);
logger.info("companyID: {}, PIN: {}",companyId, pin);
if(mode != null && mode.equals("sendPin")) {
logger.info("validate companyID only");
if (companyId == null) {
logger.error("Company id must not be empty.");
}
} else {
logger.info("validate companyID and PIN");
if (companyId == null && pin == null) {
logger.error("Company id and pin must not be empty.");
}
}
}
}
Cheers,
Borut
2009/8/19 Borut Bolčina <bo...@gmail.com>
> Hi,
>
> I am using T 5.0.18 and have problems with LinkSubmit not firing the event.
> By the way, what is the url of T 5.0.18 and its API?
>
>
> I have two TextField components, one LinkSubmit and one non-tapestry
> ordinary input submit button.
>
> I want to set some variable (varA) in case LinkSubmit is clicked, so I can
> validate the TextFields differently. In case LinkSubmit is pressed only
> first TextField is required and in case ordinary submit is pressed, both
> TextFields are required. I want to do a simple if (based on the varA) in the
> onValidate method and set the form.recordError accordingly.
>
> BUT, the event specified in the LinkSubmit is not triggered so I can not
> set the varA! Can someone please suggest a workaround or a proper solution.
>
> Thanks,
> Borut
>
> 2009/5/13 petkovf <fp...@startext.de>
>
>
>> I'm found this problem since in 5.1.0.5 (stable), in 5.0.0.18 LinkSubmit
>> work
>> properly.
>>
>> Linksubmit inside a form didn't fire events while no required property is
>> defined inside the form:
>>
>> if you add
>>
>> @Property
>> @Validate("required")
>> private String somefield;
>>
>> in java and
>>
>> <input t:type="TextField" t:id="somefield"/>
>>
>> in tml
>>
>> your LinkSubmit began event capture
>>
>> This is a huge limitation for the developers, particularly if you want to
>> filter a object (entity) view this behavior doesn't help much.
>>
>> The issue https://issues.apache.org/jira/browse/TAP5-389 describe
>> somthing
>> similar, but not in this tapestry version (5.1.0.5) and is closed in the
>> meantime.
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Component-LinkSubmit-doesn%27t-work-tp2879193p2879193.html
>> Sent from the Tapestry Users 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
>>
>>
>