'Change the state of the \'required\' flag.'

def setRequired(self, req=1):

    if req:
        self.setTag('required')
    else:
        try:
            self.delChild('required')
        except ValueError:
            return
