<form> <input type="text" id="txt"/> <input type="hidden" id="hidden"/> <a href="#" onclick="document.forms[0].hidden.value = this.id; document.forms[0].txt.value = this.name;" id="ivanomak" name="Maksim Ivanov">Maksim Ivanov</a></form>