Well, they’re both right but they have slightly different usages. “Important for me” is usually followed by “to do” or “to” some verb and the word “it” is an introductory word. “To me” is okay on its own. As in “it is important for me to lose weight” and “I want you to come to my party; it’s really important to me.” In the last sentence, “it” refers to something else, the party. In the first sentence “it” is just starting out the sentence; it isn’t referring to anything specific. I don’t know about any grammatical law regarding this, though.