Allowing empty field for editor to be submitted

Allowing empty field for editor to be submitted

codinglife456codinglife456 Posts: 4Questions: 2Answers: 0

When attempting to submit empty check in and check out input fields via the editor, despite setting the attribute to false it still returns an error displayed on the html-side indicating that these fields are required.

            {
                label: "Clock In",
                name: "clock_in",
                "defaultContent":"null",
                attr: {
                    required: false
                }
            },
            {
                label: "Clock Out",
                name: "clock_out",
                "defaultContent":"null",
                attr: {
                    required: false
                }
            },

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    The attr fields are HTML enforcements, meaning that's purely client-side. If the server is enforcing the value, then that would be something in your server-side scripts. If you post the script here, we can take a look.

    Colin

  • codinglife456codinglife456 Posts: 4Questions: 2Answers: 0

    @colin i actually dont have any server side script doing any validation, the server side script only deals with calculation based on the data sent over from the editor form.

        $input = array();
        $input = $request->all();
        $key = array_keys($input['data'])[0];
        unset($input['data'][$key]['employee_id']);
    
        if ($request['action'] == "create") {
            error_log("create section has been entered");
            error_log(json_encode($input));
        $request = $request->merge($input);
        return $editor->process($request);
    
  • codinglife456codinglife456 Posts: 4Questions: 2Answers: 0
    edited February 2021

    Isnt the validation being done simply as a result of the form sending null values over for the date fields similar to what is said in the documentation

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    No, Editor, on the client-side doesn’t do any validation by default. We focus on server-side validation, since client-side is trivial to bypass. In the example screenshot you give, the two name fields are empty and the server is doing validation on them to return those error messages.

    Can you give me a link to your page please, so I can help trace this through?

    Allan

This discussion has been closed.