Skip to main content
December 26, 2023
Question

Required field validation is not working in Site

  • December 26, 2023
  • 8 replies
  • 0 views

Required field validation is working fine in the interface and portal.

But in Site the same interface is not showing "A value is required"..

    8 replies

    venkatrea696188
    December 26, 2023

    Can you share the Code snippet

    December 26, 2023

    a!textField(
    label: "First Name",
    labelPosition: "ADJACENT",
    placeholder: "Enter First Name",
    value: ri!accessDetails.firstname,
    saveInto: {ri!accessDetails.firstname},
    refreshAfter: "UNFOCUS",
    required: true,
    validations: {
    if(
    isnull(
    cleanwith(
    ri!accessDetails.firstName,
    "1234567890"
    )
    ),
    null,
    "Please enter a valid name"
    ),
    if(
    like(ri!accessDetails.firstname," "),
    "Please enter a valid name",
    null
    )
    }
    )
    //For the text field

    a!buttonLayout(
    primaryButtons: a!buttonWidget(
    label: "SUBMIT",
    value: 3,
    saveInto: {
    a!startProcess(
    processModel: cons!GMA_CALL_ACCESS_DETAILS_PM,
    processParameters: {
    accessDetails: ri!accessDetails
    }
    )
    },
    submit: true,
    size: "STANDARD",
    color: "ACCENT",
    validate: true
    )
    )
    //For button

    amans0009
    December 26, 2023

    is it showing * sign on field (it should be according to code snippet) ?
    however your second logic for validation allows two or more spaces which looks like value is null but still our save into works and it does not shows validation on field
    could you please provide more info like  what data is coming into that field etc

    December 26, 2023

    Yes, that is also a problem, without values filled, SAVE INTO is working and empty fields are getting stored in DB.. It should not..
    For your question,.. we are saving the first name in that field

    venkatrea696188
    December 26, 2023

    In your first validation "if" you wrote it as a accept null . Just correct it .

    mohammadjavidbashaa9600
    March 6, 2024

    In this case you would not need to set "submit" to true (in fact you should probably set it to FALSE); keep the "validate" parameter set to true;