I've created a Checkbox Group field, 'myPony' with two entries:
id: one
label: One Pony
id: two
label: Two Ponies
Now I want to select some defaults using a rule for field definition. I'd like to accomplish the following scenarios:
How do I achieve this?
Thank you very much!
Welcome to this community
You can set defaults via ConfiForms Registrations Control (FormView) macro, setting the parameter to override defaults or via ConfiForms Field Definition Rules macros
myPony=one
or
myPony=one,two
Demo:
Storage format for the reference:
<ac:structured-macro ac:macro-id="2759a131-5150-44f8-b82a-9d7d1831b6b2" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="ae6b68cb-5310-4876-a004-516fa837d581" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="c3901c30-a42d-4ffd-9783-7abdd7efd53d" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">myPony</ac:parameter>
<ac:parameter ac:name="fieldLabel">myPony</ac:parameter>
<ac:parameter ac:name="values">false[one=One Pony|two=Two Ponies|]</ac:parameter>
<ac:parameter ac:name="type">checkbox_group</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>
<br/>
</p>
<p>
<br/>
</p>
<p>
<ac:structured-macro ac:macro-id="cb9f4050-cc12-4371-83ca-f6ececb6ee3a" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">setone</ac:parameter>
<ac:parameter ac:name="fieldLabel">Set one</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="14f43c78-60e4-4bc9-9644-d5e5557e786b" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">setmany</ac:parameter>
<ac:parameter ac:name="fieldLabel">Set many</ac:parameter>
<ac:parameter ac:name="type">checkbox</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="a3de4f24-b67d-4455-8db5-b5b8ae02d294" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">setone:true</ac:parameter>
<ac:parameter ac:name="values">myPony=one</ac:parameter>
<ac:parameter ac:name="action">Set value</ac:parameter>
<ac:parameter ac:name="actionFieldName">setone</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="9843cb60-1a05-4528-8c8a-516704295a3f" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">setmany:true</ac:parameter>
<ac:parameter ac:name="values">myPony=one,two</ac:parameter>
<ac:parameter ac:name="action">Set value</ac:parameter>
<ac:parameter ac:name="actionFieldName">setmany</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>via Registrations Control</p>
<ac:structured-macro ac:macro-id="7d592a6a-1606-4b62-9dd9-d4d7d507a455" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:parameter ac:name="presetValues">myPony=one,two</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
Alex
Hi Alex,
Thanks, that clarified things for me - I've got it working! Also, the video was helpful to pull it all together.
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.