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
{{ message }}
Repository navigation
Fix errors with deferred field settings panels - #3707
Three small fixes for field settings panels that load deferred (7.0), split out of #3672 so they can go out with the next release.
Dropdown type posts as select. The hidden metadata for a deferred dropdown field posted select as its type. The field type setting posts dropdown instead, because some security tools flag select as SQL injection and block the form save. The metadata now matches.
Moving a field into a section threw.updateInSectionValue looked up frm_in_section_{id}, which is not in the page while the panel is still cached, so it threw a TypeError after the move. The cached panel kept the old section. It now restores the panel first and skips the write when the input is still not there.
Checking choice options threw without Pro.checkUniqueOpt read .checked on the separate values setting, which only exists with Pro.
Testing
Open a form with dropdown fields in the builder, without selecting them. Their .frm-deferred-settings-meta type input is dropdown, not select. Saving the form keeps the fields as dropdowns.
Drag a field whose settings were never opened into a section. No console error. Open its settings and save: the field stays in the section.
With Pro inactive, edit a radio or checkbox option. No console error.
Step 1 was verified in a browser on the dev site (master posts select, this branch posts dropdown). Steps 2 and 3 were checked by reading the code but not run in a browser: step 2 saves the move over AJAX, so it needs a scratch form, and the dev site has Pro active.
js/formidable_admin.js is rebuilt, so it will conflict with other open builder PRs. Rebuild to resolve.
- Post "dropdown" as the type of a deferred dropdown field, like the
field type setting, because some security tools flag "select" as
SQL injection and block the save.
- Restore a cached settings panel before writing its in-section value
after a move, and skip the write when the input is not there yet.
Before, the lookup threw a TypeError.
- Only read the separate values setting when it exists. Without Pro
it is missing and checking a choice option threw a TypeError.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
We reviewed changes in e6b2b85...eb03c51 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Approve. Two of the three fixes reproduced on master and gone on this branch. The third (section move) I only traced in source.
Run at 116d3ea (preview env, Lite only, deferral forced with frm_ajax_load_form_builder on a 4-field form):
Dropdown type: on master the pending .frm-deferred-settings-meta input for a dropdown field was select, and after selecting the field #field_options_type_N read "" (selectedIndex -1, blank type dropdown). On this branch it is dropdown, the type dropdown shows Dropdown, and Update then reload keeps both dropdown fields as select type.
checkUniqueOpt without Pro: on master, editing a radio option label threw TypeError: Cannot read properties of null (reading 'checked'). On this branch the same edit gives zero console errors.
js/formidable_admin.js carries all three source changes (checked in the minified output; a local rebuild differs only in webpack module ids).
Not exercised: the section move (updateInSectionValue). frm_update_field_after_move is Pro, so it needs Pro and a section. I added Pro and tried a scripted mouse drag, but the sortable drop never landed, so this is source-traced only. Non-blocking observation: if ensureFieldSettings() returns null because the settings request is still in flight, the write is skipped and nothing re-applies the section id when the panel arrives. That is no worse than the old throw, and I did not confirm it can happen.
Visual check not exercised: no screenshot is attached because the field-type control is not shown in the builder panel, so a picture would not demonstrate either fix. The evidence above is DOM values and console output read through playwright-cli, not rendered output.
Not run: PHPCS and PHPStan (most CI jobs show "skipping" on this PR). The code-review skill returned no findings; security-review and simplify were not run on this 14-line diff. No JS unit test covers addFieldSettingsMetadata; optional follow-up, not required for this small fix.
When a field moves into or out of a section before its deferred
settings arrive, keep the new section in the field's settings metadata
so it replaces the server value when the panel is inserted. Add unit
tests for the settings metadata.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty method 'doAction'
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small fixes for field settings panels that load deferred (7.0), split out of #3672 so they can go out with the next release.
select. The hidden metadata for a deferred dropdown field postedselectas its type. The field type setting postsdropdowninstead, because some security tools flagselectas SQL injection and block the form save. The metadata now matches.updateInSectionValuelooked upfrm_in_section_{id}, which is not in the page while the panel is still cached, so it threw a TypeError after the move. The cached panel kept the old section. It now restores the panel first and skips the write when the input is still not there.checkUniqueOptread.checkedon the separate values setting, which only exists with Pro.Testing
.frm-deferred-settings-metatype input isdropdown, notselect. Saving the form keeps the fields as dropdowns.Step 1 was verified in a browser on the dev site (master posts
select, this branch postsdropdown). Steps 2 and 3 were checked by reading the code but not run in a browser: step 2 saves the move over AJAX, so it needs a scratch form, and the dev site has Pro active.js/formidable_admin.jsis rebuilt, so it will conflict with other open builder PRs. Rebuild to resolve.🤖 Generated with Claude Code