Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
import java.util.Arrays; import org.joget.apps.app.service.AppUtil; import org.joget.apps.form.model.Element; import org.joget.apps.form.model.Form; import org.joget.apps.form.model.FormData; import org.joget.apps.form.service.FormUtil; import org.joget.apps.form.dao.FormDataDao; import org.joget.apps.form.model.FormRow; import org.joget.apps.form.model.FormRowSet; import org.joget.plugin.base.PluginManager; import org.joget.apps.form.model.FormLoadBinder; import org.joget.commons.util.LogUtil; import java.util.Collection; import java.util.Map; import java.util.List; public boolean validate(Element element, FormData formData, FormRowSet fg2Rows) { boolean result = false; //get form grid 1 value from form data object String fg1Id = "formgrid1"; //insert form grid field id here Form form = FormUtil.findRootForm(element); Element fg1 = FormUtil.findElement(fg1Id, form, formData); if(field1!=null){ FormRowSet fg1Rows = fg1.formatData(formData); //we can iterate through each row of the "formgrid1" grid in FormRowSet fg1RowCount = fg1Rows.size(); fg2RowCount = fg2Rows.size(); //insert logic here. Below is a sample validation to make sure that fg1 row count needs to be same or more than fg2 row count if(fg1RowCount >= fg2RowCount ){ result = true; } } return result; } //call validate method with injected variable return validate(element, formData, rows);