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
===
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
linksubmit Start Page
Company ID:
PIN code:
send PIN
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
> 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
>
>
>> 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
>>
>>
>>
>> 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-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>