Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
I think you need to use a bean shell multirow validator on the grid.
and code something like this?
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.model.FormRow; import org.joget.apps.form.model.FormRowSet; public boolean validate(Element element, FormData formData, FormRowSet fgRows) { boolean result = true; System.out.println(" fgRows size >>>>>>>>> "+fgRows.size()+"\n"); int gridSize = fgRows.size(); //get selectbox value from form data object String field1Id = "totalContainer";// your selectbox field id Form form = FormUtil.findRootForm(element); Element field1 = FormUtil.findElement(field1Id, form, formData); if (field1 != null) { //get value of field 1 String compareValues = FormUtil.getElementPropertyValue(field1, formData); System.out.println(" compareValues >>>>>>>>> "+compareValues+"\n"); int i=Integer.parseInt(compareValues); //compare the value of gridsize and field 1 are equals if (gridSize!=i) { String id = FormUtil.getElementParameterName(element); formData.addFormError(id, "Value not equal!!!!"); result = false; } } else { //ignore if the field 1 not exist } return result; } //call validate method with injected variable return validate(element, formData, rows);
I used this as a reference:
Bean Shell Programming Guide - Knowledge Base for DX 7 - Joget | COMMUNITY
Hi, I will look into this method. Thank you.
Hi,
I am trying to implement a feature where the user will select the Total Container, lets say '3'. Automatically this act as a validator and restrict the number of rows that can be added in a grid. Example similar to Figure 1.
Is there a way or method of achieving this?
Figure 1