Validators depending oneditprepare

With oneditprepare I switch the html form elements:

oneditprepare: function() {
  $("#node-input-ThresholdType").change(function() {
    if ($(this).val() === "fixed") {
      $(".form-row-ThresholdTypeFixed").show();
      $(".form-row-ThresholdTypeDynamic").hide();
    } else {
      $(".form-row-ThresholdTypeFixed").hide();
      $(".form-row-ThresholdTypeDynamic").show();
    }
  });

Depending on the shown elements I would like to validate / require different #node-inputfields. When setting the validator or required properties in defaults they are globally active.
How can I set these properties according to the change function?

I haven't tried this myself, but I wouldn't be surprised if you could get away with something like

oneditprepare: function() {
    $("#node-input-ThresholdType").change(function() {
        if ($(this).val() === "fixed") {
            node.defaults.ThresholdType.validate = function(value) {
...

Hi Sineos,

I think you can do something like this:

defaults: {
            ...
            thresholdTypeFixed: {
                value: 0,
                validate: function(v) {
                    var thresholdType = $('#node-input-ThresholdType').val();
                    if (thresholdType === "fixed")
                           // Return value based on type ...
                }},

Bart