Existing Repeat Entry Expanded Flag

📋 Overvie

Automatically set a flag field when users expand existing repeat entries, enabling workflows and conditional logic based on user interaction. This JavaScript solution tracks when users expand existing repeat entries and sets a flag field to true within the same entry. This enables you to trigger workflows, show/hide fields, or perform other actions when users interact with repeat data.

image

Example form template:

Repeat Expand Indicator.json12.2 KB

✅ What it does:

  • Detects when existing repeat entries are expanded
  • Sets a designated flag field to 'true'
  • Triggers change events for workflow integration
  • Works only with existing repeat entries (not new ones)

🛠️ Setup Requirements

Required Components:

  1. Repeat Field - Your main repeat group
  2. Flag Field - A field inside the repeat entry (can be Hidden, Text, Checkbox, etc.)
  3. JavaScript Field - To contain the tracking script

Field IDs Needed:

  • repeat_field_id - Component ID of your Repeat field
  • flag_field_component_id - Component ID of the flag field inside repeat entries

⚙️ Implementation Steps

Step 1: Add JavaScript Field

  1. Add a JavaScript component to your form (same page as the Repeat)
  2. Set load delay to 100ms (recommended)

Step 2: Configure Script Variables

Update these two variables in the script:

// Replace with your Repeat field's component_id
var repeat_field_id = 'YOUR_REPEAT_COMPONENT_ID';
// Replace with your flag field's component_id
var flag_field_component_id = 'YOUR_FLAG_FIELD_COMPONENT_ID';

Step 3: Add Complete Script

Copy the full script from the JavaScript Code section below.

Step 4: Test Implementation

  1. Save your form
  2. Create some existing repeat entries (prefilled or previously saved)
  3. Click to expand an existing entry
  4. Verify the flag field updates to 'true'

💻 JavaScript Code

🔗 Workflow Integration

Using with Field Updates

  1. Add Field Update Button inside the same repeat entry
  2. Configure visibility: Only show inside existing repeat entries
  3. Add condition: Show when flag field = 'true'
  4. Map updates: Configure field mappings as needed
  5. Enable silent updates: Set "Update Fields Silently" if available

Event Flow:

User expands entry → Flag set to 'true' → Field Update triggers → Other fields update

🐛 Troubleshooting

Common Issues:

❌ "Field not found" console error

  • Verify flag_field_component_id is correct
  • Ensure flag field is inside the repeat entry
  • Check that field wrapper has proper component ID attributes

❌ Script doesn't trigger

  • Confirm repeat_field_id matches your repeat component
  • Ensure you're testing with existing entries (not new ones)
  • Check browser console for JavaScript errors

❌ Flag field not updating

  • Verify field is not read-only or disabled
  • Check that field supports the value type being set
  • Ensure change events are not blocked by other scripts

Debugging Tips:

  • Open browser console to see error messages
  • Check the logged available wrapper IDs for mismatches
  • Test with a simple text field before using hidden fields

📚 Field Type Support

Field Type
Set Method
Value
Text
.val('true')
'true'
Hidden
.val('true')
'true'
Checkbox
.prop('checked', true)
checked
Textarea
.val('true')
'true'
Select
.val('true')
'true'

💡 Use Cases

  • Conditional Logic: Show additional fields when entries are expanded
  • Workflow Triggers: Run Field Updates based on user interaction
  • Analytics: Track which repeat entries users are viewing
  • Progressive Disclosure: Load additional data when entries are opened
  • Validation: Apply rules only to entries that have been reviewed

⚠️ Important Notes

  • Only works with existing repeat entries (prefilled or saved data)
  • Requires jQuery (standard in FormYoula forms)
  • Flag field must be inside the same repeat entry
  • Change events are triggered for proper workflow integration
  • Compatible with Bootstrap collapse events used by repeat entries