Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

[UI Script] Make Elapsed field required on Add Test Result dialog


#1

The following UI script makes the Elapsed field required on the Add Test Result dialog. Please note that this is a client-side validation only.

[code]name: Make Elapsed field required
description: Makes the Elapsed field required on the Add Test Result dialog
author: Gurock Software
version: 1.0
includes:
excludes:

js:
(document).ready( function() { .subscribe(‘result_dialog.loaded’, ‘uiscript_require_elapsed’, function(o)
{
$(’#addResultElapsed’).prev().append(’ *’);
});

    $.subscribe('result_dialog.validate', 'uiscript1', function(o)
    {
        if ($.trim(o.values.elapsed) == '')
        {
            $('#addResultErrors').append('Field Elapsed is a required field.');
            $('#addResultErrors').show();
            o.event.stopPropagation();
            return;
        }
    });
}

);[/code]

Regards,
Tobias


Required field for test results based on test result type?
#2

Updated for TestRail 4.0:

[code]name: Make Elapsed field required
description: Makes the Elapsed field required on the Add Test Result dialog
author: Gurock Software
version: 1.0
includes:
excludes:

js:
(document).ready( function() { .subscribe(‘result_dialog.loaded’, ‘uiscript_require_elapsed’, function(o)
{
$(’#addResultElapsed’).prev().append(’ *’);
});

    $.subscribe('result_dialog.validate', 'uiscript_require_elapsed', function(o)
    {
        if ($.trim(o.values.elapsed) == '')
        {
            $('#addResultErrors').append('Field Elapsed is a required field.');
            $('#addResultErrors').show();
            o.event.stopPropagation();
            return;
        }
    });
}

);[/code]


Conditional field based on status