Instead of hidden use render here so the link won't even be sent to the client if not configured. Of course the logic will be reverse.