Message on Confirmation Page

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
morrellaberdeen
User
Posts: 187

Message on Confirmation Page

Post by morrellaberdeen »

I wish to disable the Confirm Button when that page is loaded. I would want to place a message with option, yes/no buttons on the Confirm page with a message that tells users that no further edits will be allowed after submission of the form. If the user agrees by choosing the 'yes' option, the Confirm button is enabled. When the user presses the Confirm button, the Yes option should be inserted into the database along with the rest of the form. The form fields should be set to read-only.

How can this be done?


arbei
User
Posts: 9396

Post by arbei »

morrellaberdeen wrote:

I wish to disable the Confirm Button when that page is loaded.

Then you should disable the "Confirm" option of the page.

I would want to place a message with option, yes/no buttons on the Confirm page with a message that tells users that no further edits will be allowed after submission of the form. If the user agrees by choosing the 'yes' option, the Confirm button is enabled. When the user presses the Confirm button, the Yes option should be inserted into the database along with the rest of the form. The form fields should be set to read-only.

You may add a "beforesubmit" event to the form, add your dialog, set the value of the field (which can be a field with HIDDEN Edit Tag), say, "Agreed" as 'yes'. When the user edit the form, you should use Row_Rendered server event to check the field value of "Agreed", if it is 'yes', then you set the fields as ReadOnly (text input fields) or Disabled (non text input fields). For example, if the table is "cars" and the page is Edit page, in Startup Script of the page,

fcarsedit.on("beforesubmit.morrell", function (e, args) { // You better use a namespace to distinguish your handlers from others 
  // Your code to open your dialog, e.g. by SweetAlert2
  Swal.fire({
    title: "...?",
    showDenyButton: true,
    showCancelButton: true,
    confirmButtonText: "Yes",
    denyButtonText: "No"
  }).then((result) => {
    args.result = result.value;
    if (result.value) {
      // Your code to set the value of the "Agreed" field
    }
  });
});

Post Reply