1
0
-1

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:


    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

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

      1. Ulisses

        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)

      CommentAdd your comment...