Dynamically Change The Action Form Attr

What you can do is, add a listener for submit action to your form. Once it is triggered, you need to prevent the default behavior of the form submit action and do some calculations to change the action attribute dynamically based on some conditions. Once the updated action attribute is set, you can trigger submit method programatically.

const form = document.getElementById("form_id");

form.addEventListener("submit", (e) => {
  e.preventDefault(); // <- HERE you stop the exection before some processings

  let action = "index.html";

  if (/* some condition */) {
    action = "index_admin.html";
  }

  form.setAttribute("action", action);
  form.submit();
});

Although, I would suggest not to use direct password/login conditions checks inside your code, since it can be inspected from the browser and people can use this to hack credentials of admin somehow.