dialog add id function, need improvement