Quotas & Terminations

Forsta HX Platform - API Scripting Guide

Quotas & Terminations

⚠️ Euro SaaS Platform Note

Quota management and termination logic should be configured through the Forsta HX Platform's built-in quota and routing features rather than custom JavaScript. Use the platform's native quota settings in the survey designer.

Client-side Screening Logic (Use Platform Routing Instead):

// For client-side screening, use Forsta API methods
// Note: Actual terminations should use platform routing, not JavaScript redirects

// Check screening criteria
f('AQ1').on('change', function() {
    var age = parseInt(f('AQ1').get());
    var gender = f('AQ2').get();
    
    // Show/hide based on criteria
    if (age >= 18 && age <= 65) {
        f('BQ1').show(); // Qualified - continue
    } else {
        f('BQ1').hide(); // Not qualified - platform will route
    }
});

// For actual terminations, configure routing rules in:
// Survey Designer → Routing → Termination Rules

Validation Before Submission:

// Validate eligibility criteria using Forsta methods
function validateEligibility() {
    var age = parseInt(f('AQ1').get());
    var hasCondition = f('AQ2').item('1').toBoolean();
    
    // Check multiple criteria
    if (age < 18) {
        alert('You must be 18 or older to participate.');
        return false;
    }
    
    if (!hasCondition) {
        alert('You must meet the study criteria to continue.');
        return false;
    }
    
    return true;
}