Skip to content

Commit

Permalink
FIX: rest validation endpoint does not accept 0 as form input
Browse files Browse the repository at this point in the history
When using a advanced form field validation rule of type server-side callback the  rest validation endpoint will terminate the request with a http code 400 when a 0 is passed as the form field value.
  • Loading branch information
markoste authored Dec 9, 2024
1 parent fc93f17 commit ac6b800
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/validation/rest-api/rest-validation-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function run_callback( \WP_REST_Request $request ) {
array( 'rules', $body[ self::RULE_INDEX_KEY ] )
);

if ( ! $parser->get_value() || empty( $ssr_attrs['value'] ) ) {
if ( null === $parser->get_value() || '' === $parser->get_value() || empty( $ssr_attrs['value'] ) ) {
return new \WP_REST_Response(
array(
'message' => __( 'Field value or callback is empty', 'jet-form-builder' ),
Expand Down

0 comments on commit ac6b800

Please sign in to comment.