Please check the order of the fields in Page.. Example, Posting Date, Document no, Account Type, Account no. description, amount, and etc,
The field validation goes based on the fields order in the page.
Regarding Amount blank, do not assign amount to Debit or Credit Amount field in your code.. just assign to Amount field alone should be fine.