/redaxo-yform:yform-frontendfrom redaxo-yform
Builds public-facing YForm forms in REDAXO: contact forms, registration, surveys, edit-existing-record forms, file uploads with email attachments, spam protection, CSRF tokens, and objparams cheat sheet.
Ships in redaxo-yform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
YForm builds frontend forms from one of two equivalent definitions:
rex_yform::factory()->setValueField/setValidateField/setActionFieldPick whichever the surrounding code already uses. Both compile to the same form.
<?php
$yform = rex_yform::factory();
$yform->setObjectparams('form_name', 'contact');
$yform->setObjectparams('form_action', rex_getUrl()); // submit to same page
$yform->setObjectparams('form_anchor', 'contact-form'); // jump to anchor on submit
$yform->setObjectparams('real_field_names', true); // input names = field names
// Fields
$yform->setValueField('text', ['name', 'Name']);
$yform->setValueField('text', ['email', 'Email']);
$yform->setValueField('textarea', ['message', 'Message']);
$yform->setValueField('checkbox', ['agree', 'I agree to the privacy policy.']);
// Validators
$yform->setValidateField('empty', ['name', 'Please enter your name.']);
$yform->setValidateField('empty', ['email', 'Please enter your email.']);
$yform->setValidateField('type', ['email', 'email', 'Please enter a valid email.']);
$yform->setValidateField('empty', ['message', 'Please enter a message.']);
$yform->setValidateField('empty', ['agree', 'You must agree to the privacy policy.']);
// Action: send mail using a configured email template
$yform->setActionField('tpl2email', [
'contact_form', // template name (managed in backend → YForm → Email Templates)
'[email protected]', // recipient: fixed address, or the name of a form field holding one
'Website team', // recipient display name (literal text, not a field name)
]);
// There is no sender parameter: From/Reply-To come from the template. To reply to the
// visitor, set the template's Reply-To to REX_YFORM_DATA[field="email"].
// Hide the form once it was submitted successfully
$yform->setObjectparams('form_showformafterupdate', false);
echo $yform->getForm();
// After successful submit:
if (1 == $yform->objparams['actions_executed']) {
echo '<div class="alert alert-success">Thank you – we\'ll get back to you.</div>';
}
objparams|form_action|/?article_id=5
objparams|form_name|contact
text|name|Name
text|email|Email
textarea|message|Message
checkbox|agree|I agree to the privacy policy.
validate|empty|name|Please enter your name.
validate|empty|email|Please enter your email.
validate|type|email|email|Please enter a valid email.
validate|empty|message|Please enter a message.
validate|empty|agree|You must agree to the privacy policy.
action|tpl2email|contact_form|[email protected]|Website team
action|showtext|<p>Thank you – we'll get back to you.</p>||1
| Param | Default | Description |
|---|---|---|
form_action | index.php | Form submit target; does not preserve the current request's query string |
form_action_query_params | [] | Extra query params for the action URL |
form_method | post | HTTP method |
form_anchor | `` | Anchor (#id) used after submit |
form_name | formular | Form name attribute (must be unique per page!) |
form_class | rex-yform | CSS class |
form_wrap_id / form_wrap_class | rex-yform / yform | Wrapper div ID/class |
form_label_type | html | html outputs labels unescaped; any other value (e.g. plain) escapes them |
form_ytemplate | bootstrap,classic | Comma-separated ytemplate fallback chain (default is always appended) |
form_show | true | Render the form |
form_showformafterupdate | false | Show the form again after submit |
submit_btn_label | Abschicken | Submit button text |
submit_btn_show | true | Render the default submit button |
error_class | form-warning | CSS class for error fields |
real_field_names | false | Use real field names (not yform indices) |
csrf_protection | true | Enable CSRF protection |
debug | false | Print debug info |
hide_top_warning_messages | false | Hide the top error summary |
hide_field_warning_messages | false | Hide per-field error messages |
getdata | false | Load existing data (for edit forms) |
main_table | `` | Table for getdata |
main_where | `` | WHERE clause for getdata |
form_exit | false | true = getForm() cleans the output buffers and calls exit (the redirect action sets it) |
$yform = rex_yform::factory();
$yform->setObjectparams('form_action', rex_getUrl(REX_ARTICLE_ID));
$yform->setObjectparams('getdata', true);
$yform->setObjectparams('main_table', 'rex_my_table');
$yform->setObjectparams('main_where', 'id=' . (int) rex_request('id', 'int'));
// ...fields and validators (same as a create form)...
// manage_db: insert or update depending on existence
$yform->setActionField('manage_db', ['rex_my_table']);
echo $yform->getForm();
For dataset-driven edit forms, use the dataset's own form helpers (see the yform-datasets skill).
$yform->setValueField('upload', ['attachment', 'Attachment']);
$yform->setValueField('php', ['php_attach', 'Attach',
'<?php if (isset($this->params["value_pool"]["files"])) {
$this->params["value_pool"]["email_attachments"] =
$this->params["value_pool"]["files"];
} ?>'
]);
$yform->setActionField('tpl2email', ['contact_form', '[email protected]', 'Website team']);
The php value field re-keys the uploaded files into the email-attachments pool that tpl2email reads.
YForm enables CSRF tokens by default — keep them enabled. The token is rendered automatically when the form is built; if you wrap the form in custom JS-driven submission, make sure the token field travels with the request.
Real users take more than ~3 seconds to fill a form. Bots usually don't.
hidden|timestamp|{"type":"hidden"}|REQUEST|time
validate|customfunction|timestamp|myclass::checkTimestamp||Bot detected
class myclass {
public static function checkTimestamp($label, $value, $params, $return) {
return (time() - $value) < 3; // true = error if submitted in < 3 seconds
}
}
Hidden field bots fill in but humans never see.
text|website|{"type":"hidden"}
validate|customfunction|website|myclass::checkHoneypot||Bot detected
class myclass {
public static function checkHoneypot($label, $value, $params, $return) {
return !empty($value); // true = error if filled
}
}
For higher-stakes forms, integrate friendly_captcha or friendsofredaxo/recaptcha — they ship YForm value/validate types you can drop in.
showifShow field B only when field A has a specific value:
$yform->setValueField('choice', [
'inquiry_type', 'Inquiry',
'General=general,Sales=sales,Support=support',
'general', '', '', '0', 'select'
]);
$yform->setValueField('text', ['order_id', 'Order ID', '', '', '', 'showif=inquiry_type==support']);
showif supports ==, !=, >=, <=, and comma-separated value lists.
Database only:
$yform->setActionField('db', ['rex_tablename']);
Email only:
$yform->setActionField('tpl2email', ['template_key', 'email_field']); // recipient = address in email_field
Database + Email:
$yform->setActionField('db', ['rex_tablename']);
$yform->setActionField('tpl2email', ['template_key', 'email_field']); // recipient = address in email_field
Show success message:
$yform->setActionField('showtext', ['<p>Vielen Dank!</p>', '', '1']); // '1' = HTML format
Wrap the form in a module so editors can place it on any page:
<?php
// Module input
?>
<fieldset>
<legend>Contact form</legend>
<div class="form-group">
<label>Email template</label>
<input type="text" name="REX_INPUT_VALUE[1]"
value="REX_VALUE[1]" class="form-control"
placeholder="contact_form">
</div>
</fieldset>
<?php
// Module output
$template = trim('REX_VALUE[1]') ?: 'contact_form';
$yform = rex_yform::factory();
$yform->setObjectparams('form_name', 'contact_' . REX_SLICE_ID);
$yform->setObjectparams('form_action', rex_getUrl());
$yform->setObjectparams('form_anchor', 'contact-form');
$yform->setValueField('text', ['name', 'Name']);
$yform->setValueField('text', ['email', 'Email']);
$yform->setValueField('textarea', ['message', 'Message']);
$yform->setValidateField('empty', ['name', 'Please enter your name.']);
$yform->setValidateField('empty', ['email', 'Please enter your email.']);
$yform->setValidateField('type', ['email', 'email', 'Please enter a valid email.']);
$yform->setValidateField('empty', ['message', 'Please enter a message.']);
$yform->setActionField('tpl2email', [$template, '[email protected]', 'Website team']);
echo '<a id="contact-form"></a>';
echo $yform->getForm();
if (1 == $yform->objparams['actions_executed']) {
echo '<div class="alert alert-success">' . rex_escape(rex_i18n::msg('contact_form_success')) . '</div>';
}
The slice-id suffix keeps form_name unique when several slices on the same article render this form – an article-id suffix would be identical for all of them.
form_name for two forms on one page – field names (FORM[<form_name>][…]) and the CSRF token id derive from it, so submitting one form makes the other one process the request as well. With real_field_names enabled, form_name no longer separates the inputs at all: every form reads the same top-level request keys (send, field names).form_action defaults to index.php, and rex_getUrl() only appends the $params passed to it, so a query parameter of the current request (e.g. a detail page's ?id=) is gone after POST. Add them with $id = rex_request::get('id', 'int', 0); if ($id) { $yform->setObjectparams('form_action_query_params', ['id' => $id]); } – an explicit default avoids appending id=0 when the current request has none.rex_escape() placeholders in the HTML body.setObjectparams('real_field_names', true) – field input names get yform-mangled, breaking analytics and JS form-builder integrations.actions_executed state – the form re-renders empty after submit but no confirmation appears.manage_db with explicit db action – manage_db already does the insert/update, adding db causes double-writes.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
redaxo, yform, frontend-forms, contact-form, spam-protection, email-action
6 skills in this plugin
/yform-datasetsORM-style read/write on YForm tables using rex_yform_manager_dataset and the query builder (rex_yform_manager_query). Covers model classes, all where/join/select/order/group methods, relations, pagination via rex_pager, CRUD, dataset-driven forms, and SQL debugging. Use when the user reads or writes to a YForm table from PHP, builds custom backend lists, joins related tables, paginates, or queries datasets in frontend templates./yform-email-templatesYForm email templates – placeholder syntax, sending mails from forms via tpl2email, sending mails programmatically from PHP, attachments, and using REX_YFORM_DATA placeholders. Use when the user creates or edits a YForm email template, configures tpl2email actions, sends YForm-template-based emails outside a form (e.g. cronjob, callback), or troubleshoots placeholder substitution./yform-fieldsYForm field types, validators, and actions – the building blocks for forms and tables. Covers all value/validate/action types with parameters, the choice / be_manager_relation / upload field configurations, custom field types, and the pipe syntax used in the Formbuilder. Use when picking field types, configuring validators, building custom field/validator classes, troubleshooting field rendering or save behavior, writing forms in pipe syntax, or when the user says "Feldtypen", "YForm-Felder", "Validierung", "Formular-Felder", "be_manager_relation", or "Formbuilder Pipe-Syntax"./yform-rest-apiYForm's built-in REST API – exposing YForm tables as JSON:API endpoints. Covers route registration via rex_yform_rest_route, GET filter/include/order/pagination params, JSON:API POST bodies, DELETE, token-based authentication, and CORS headers. Use when the user exposes a YForm table as a REST endpoint, configures token auth, customizes per-method field whitelists, builds a frontend SPA that calls a YForm-backed API, or says "REST-Endpoint", "JSON-API", "Token-Auth", "API-Aufrufe", "Endpunkt für YForm-Tabelle"./yform-tablesDefining and managing YForm tables in REDAXO – Table Manager backend UI, rex_yform_manager_table::ensure() in install.php, schema migrations, and tableset import/export. Use when the user works with YForm tables, edits install.php for a yform-using addon, defines field configurations, configures table-level options (pagination, search, history, export/import), or migrates table schemas between versions.npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-yformOther plugins' skills for the same job