You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am dealing with an issue, I have a select input (true/false) and base on the boolean value I am changing second input label between 2 strings. For all my inputs I am using that same label as an attribute name to be used in all validation messages mainly because of localization. All my validations are defined as Form Request Validation.
To correctly change the attribute name base on the select input as well I am currently using attributes() method to override the string base on condition request()->select_value == true and it works just fine for laravel serverside validation, but this package is struggling with this issue.
I know that this package is loading the attributes on page load where request()->select_value is always undefined as well as other form data but I have no idea how to dynamically change attributes directly with javascript or maybe use better variable in the current condition inside attributes() method. Any advice or enhancement would be great!
Your environment
version of this package: v4.8.1
version of Laravel: v10.43.0
Steps to reproduce
Prepare html form with 2 inputs: first select with true/false and second arbitrary.
Create validation class as Form Request Validation with any validation for second input e.g. required rule.
Customize attribute inside attributes() method and apply condition request()->select_value == true to dynamically change attribute string for the second input base on the first input value.
Apply JsValidator.
Leave second input empty and submit the form.
Observe error message when changing the first input.
Expected behaviour
Changing the error message to use correct attribute string.
Actual behaviour
Error message remains the same.
The text was updated successfully, but these errors were encountered:
Subject of the issue
Hello,
I am dealing with an issue, I have a select input (true/false) and base on the boolean value I am changing second input label between 2 strings. For all my inputs I am using that same label as an attribute name to be used in all validation messages mainly because of localization. All my validations are defined as Form Request Validation.
To correctly change the attribute name base on the select input as well I am currently using
attributes()
method to override the string base on conditionrequest()->select_value == true
and it works just fine for laravel serverside validation, but this package is struggling with this issue.I know that this package is loading the attributes on page load where
request()->select_value
is always undefined as well as other form data but I have no idea how to dynamically change attributes directly with javascript or maybe use better variable in the current condition insideattributes()
method. Any advice or enhancement would be great!Your environment
Steps to reproduce
required
rule.attributes()
method and apply conditionrequest()->select_value == true
to dynamically change attribute string for the second input base on the first input value.Expected behaviour
Changing the error message to use correct attribute string.
Actual behaviour
Error message remains the same.
The text was updated successfully, but these errors were encountered: