How to make field mandatory in the portal only

How to make field mandatory in the portal only

Hi
How can we have fields that are voluntarily entered into the CRM but are mandatory in the Portal? Ive written a function which detects if the record is being updated by a non-admin (ie a portal user), and if a field contains an empty string. But I cant make it show a message to the portal user that they have to fill in the field.
How can I make this work?
Thanks