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

[UI Script] Make field required if test is in particular state


#1

On add test result dialog I only want to make a field required if the test is in a particular state e.g. if the test is failed then the comment field should be required.

I have tried using the following:
uiscripts.context.test

with uiscripts.context.test.status to try and get the status of the result dialog, however this is unsuccessful. Any help appreciated. thanks as always


#2

Hello Gavin,

Thanks for your posting. The idea is to use the current status of the dialog which is passed to UI scripts via the result_dialog.validate event. Please see below for an example (by another customer):

http://forum.gurock.com/topic/1989/required-if-pass/

I hope this helps and please let us know in case you have any further questions.

Regards,
Tobias


#3

Thanks that works, however is there is a way to hide the ‘*’ based on the type of result_dialog.loaded.

At the moment this is still present next to the fields even though that field is not required for example when the test has passed.


#4

Hello Gavin,

Thanks for your reply and great to hear that this works for you.

This wouldn’t be supported currently unfortunately (as you would need to show/hide the * based on the current status selection and it’s currently not supported to register an event handler for this action) but we are happy to add this as a feature request.

Regards,
Tobias