I am working on an app where Admin can publish a welcome message to the public page. I need to have a warning message before Publishing the message, basically, after they click ‘Publish to Public page’ show a warning which says “You are about to publish this content to the world, on your public status page. It will be visible to all internet users, not just your colleagues. Click ‘OK’ to publish or ‘Cancel’ to go back.
If they click ‘Cancel’ provide a warning like ‘Are you sure you want to Cancel? Click ‘OK’ to delete your Edits’
I have the first of the warning so far:
My form
<form accept-charset="UTF-8" id ="edit-public-page-form" class="message-form" action="<%= public_page_path %>" method="post" data-image-path="<%= upload_image_noticeboards_path %>">
<textarea class="noticeEditor" name="content" style="width: 100%; height:340px;">
<%= @welcome_message %>
</textarea>
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<%= hidden_field_tag :_method, "put" %>
<br>
<%= t('statusx.public_page_link')%>
<%= link_to "https://demo.getvetter.com/public", target: :_blank %>
<br>
<br>
<button
id='saveButton'
class="btn btn-primary tn-w-m"><%= t('statusx.save') %></button>
<button id="cancel_submit" class="btn btn-default btn-w-m"><%= t('cancel') %></button>
</form>
$('#edit-public-page-form').submit(function(event) {
return confirm('You are about to publish this content to the world, on your public status page. It will be visible to all internet users, not just your colleagues. Click \'OK\' to publish or \'Cancel\' to go back.');
});
I just don't know how to implement the second part of the warning. Thanks for your help