/* Simple client-side validation utilities */
function confirmDelete() { return confirm('Are you sure?'); }

function validateUserForm(form) {
  var username = form.username.value.trim();
  var pw = form.password ? form.password.value : '';
  if (!username) { alert('Username is required'); return false; }
  if (form.password && form.password.required && !pw) { alert('Password is required'); return false; }
  return true;
}

function validateMoneyForm(form) {
  var amount = form.amount.value.trim();
  var date = form.date.value.trim();
  if (!amount || isNaN(amount) || Number(amount) <= 0) { alert('Enter a valid amount'); return false; }
  if (!date) { alert('Date is required'); return false; }
  return true;
}
