
外掛標籤
開發者團隊
② 後台搜尋「Set Value Logic for Fluent Forms」→ 直接安裝(推薦)
原文外掛簡介
Conditional logic normally does one of two things: show a field, or hide it. This plugin adds a third action — write a value into a field.
A rule points at one field and decides what goes into it. That can be a calculation from other fields, or a predefined value chosen by conditions. Values appear as the visitor types, and are worked out again on the server before the entry is stored.
A worked example
A form asks for marks and credits, then shows a calculated value and a grade:
Rule 1 sets Calculated value to {marks} * {credit}
Rule 2 sets Grade to D when the calculated value is under 30, C under 60, B under 100, and A otherwise
Entering 30 marks and 4 credits fills in 120 and A while the visitor is still on the page.
What a rule can do
Calculate a field from other fields using a formula
Write a fixed value when conditions match, with as many if / otherwise-if branches as you need
Fall back to a default value when no branch matches
Clear a field
Round to a set number of decimal places
Stop visitors typing into a computed field
Formulas
Reference a field by wrapping its name in braces, for example {marks} * {credit}. Anything that is not a number counts as zero.
Operators: + - * / % ^, comparisons < <= > >= == !=, logic && || !, and parentheses.
Functions: min max sum avg abs round floor ceil sqrt pow if len number. The first four accept any number of arguments.
Division by zero returns zero rather than an error, so a half-filled form does not show NaN while someone is still typing.
Formulas never go near eval(). They are tokenised and run on a small stack machine, and any name that is not a known function is rejected before evaluation.
Condition operators
Equal to, not equal to, greater than, greater than or equal to, less than, less than or equal to, contains, does not contain, starts with, ends with, is one of, is not one of, is empty, is not empty.
When both sides look like numbers they are compared as numbers, so 10 is correctly greater than 9. Text comparison ignores case.
Values are worked out twice, on purpose
A read-only input can be edited with browser developer tools, so a computed value is never trusted as submitted. Every rule runs again in PHP before the entry is written, and those results are what reach the entry, notifications and integrations.
Where it lives
The plugin appears as a card on Fluent Forms → Integrations → Modules, alongside the other modules, with the same on/off switch.
Once it is switched on, each form gains an Advanced Conditional Logic entry in its Settings & Integrations sidebar, directly below Conditional Confirmations. That is where you write rules for that form. The gear icon on the modules card opens the same builder with a form picker, if you would rather start there.
There is no extra item in the WordPress admin sidebar.
Requires Fluent Forms
This is an add-on. It needs the free Fluent Forms plugin installed and active, and works with both the free and Pro editions. It is an independent project and is not affiliated with, endorsed by, or supported by WPManageNinja LLC, the makers of Fluent Forms.
Privacy
The plugin contacts no external service, loads no remote assets, and collects no data about you or your visitors. Rules are stored in your own database and nowhere else.
Source code
No build step is used. Every JavaScript and CSS file shipped in the plugin is the original, readable source. Development happens at the link in the plugin header.
