Validate simultaneously Textbox And Radio Option in Form

Confluence User - 13 Dec, 2022

Hello, i have a text box and a radio button and i am trying to simultaneously validate the value entered iin the textbox and in the radio (in the form the id of the radio button is  radio_tipoobra)

For some reason i cannot make this work, appreciate some help thanks....


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, "No value for input!");
    return false;
}else{
    float amountF = Float.parseFloat(amount.replace(',', '.'));
    if((amountF >1000000) && (#binder.dadosrisco.radio_tipoobra# == 'reab')){
        formData.addFormError(id, "Error, max value allowef for reab is 1 000 000,00€ ");
        return false;
    }
}

return true;



Error:


forms;formbinderhashvariable

2


13 Dec, 2022
confluenceUser
1
confluenceUser

Hi, try checking the value for hash variable #binder.dadosrisco.radio_tipoobra# to make sure that it is returning a valid value. 

14 Dec, 2022
confluenceUser
confluenceUser

Hi there, yes its returning the expected value. It seems by the error that maybe is the java sintax that is incorrect. Tried alternatives but no success! (sad)

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print