Hi Kranthi,
The user clicks on Submit only after the he enters data/submits data, I think its better to write the logic on the Submit button itself, for the visibility of the UI, since there is no point in enabling the second link, with him just entering the data and closing the pop up without submitting.
Regards,
Harsha