Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
Code Block | ||||
---|---|---|---|---|
| ||||
import java.util.Arrays; import org.joget.apps.form.model.Element; import org.joget.apps.form.model.FormData; import org.joget.apps.form.service.FormUtil; if(values[0].length() > 500){ String id = FormUtil.getElementParameterName(element); formData.addFormError(id, "Value cannot be longer than 500 characters. You have entered " + values[0].length() + " characters."); return false; }else{ return true; } |
Field value does not exceed 500 in numerical value
Code Block | ||||
---|---|---|---|---|
| ||||
import java.util.Arrays;
import org.joget.apps.form.model.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.service.FormUtil;
String id = FormUtil.getElementParameterName(element);
String amount = "";
if(values.length > 0){
amount = values[0];
}
if(amount.isEmpty()){
formData.addFormError(id, "Please key in a amount.");
return false;
}else{
float amountF = Float.parseFloat(amount);
if(amountF >=500){
formData.addFormError(id, "Amount cannot be more than 500.");
return false;
}
}
return true; |
...