diff --git a/app/RSpade/upstream_changes/text_field_max_lengths_12_29.txt b/app/RSpade/upstream_changes/text_field_max_lengths_12_29.txt index 205cba56c..9659daa25 100755 --- a/app/RSpade/upstream_changes/text_field_max_lengths_12_29.txt +++ b/app/RSpade/upstream_changes/text_field_max_lengths_12_29.txt @@ -54,13 +54,61 @@ This is generated automatically from database schema metadata. ## Migration Checklist -### 1. Find all Text_Input components +### 1. Update Text_Input component files + +**rsx/theme/components/inputs/text/text_input.js** - Add on_create() method: + +```javascript +class Text_Input extends Form_Input_Abstract { + on_create() { + super.on_create(); + + // Only require $max_length when Text_Input is used directly, not subclasses + if (this.constructor === Text_Input && this.args.max_length === undefined) { + console.error( + `Text_Input with $name="${this.args.name}" requires $max_length. ` + + `Use $max_length=Model_Name.field_length('column_name') for database-driven limits, ` + + `a numeric value for custom limits, or -1 for unlimited.` + ); + } + } + + // ... rest of existing code (keep _get_value, _set_value, on_ready, seed) +} +``` + +**rsx/theme/components/inputs/text/text_input.jqhtml** - Update template: + +1. Change all `this.args.maxlength` to `this.args.max_length` +2. Change condition from `if (this.args.maxlength)` to `if (this.args.max_length > 0)` +3. Add maxlength to textarea (was missing before): + +```html + +``` + +Apply the same `max_length > 0` check to both input elements in the template. + +### 2. Rebuild manifest + +```bash +php artisan rsx:manifest:build --clean +``` + +This regenerates JS model stubs with the new `field_length()` method. + +### 3. Find all Text_Input usage in forms ```bash grep -rn ' ``` -### 3. Verify no console errors +### 5. Verify no console errors Load each form and check browser console. Any Text_Input missing `$max_length` will log: