I have a dialog box that is opened when field validation errors are found. I have successfully captured the html formatted text inside the jQuery dialog box. I have 3 buttons defined in the dialog box. Continue (close the dialog box), Show Fields (which should display the fielderrors html text) and Show Details (which should show error details)
Here is the HTML code from the Page
<div id="dialogpresubval" title="Pre-Submit Validation Errors" style="display:none">
<div id="fielderrors" style="display:none"> </div>
<div id="errordetail" style="display:none"> </div>
</div>
This is the code in the .js file within the Ready function when I press the Submit button on the Main Form, I get back the presubfields and presubdetail variables. I know that part is working because the console.log lines show the right information. For test purposes here you can use
var presubfields = "The following fields contain errors: <br> member status <br> member since";
$(function() {
$( "#dialogpresubval").dialog({
autoOpen: false,
hide: "puff",
modal: true,
closeOnEscape: false,
height:400,
width:450,
resizable: true,
draggable: true,
title: "Pre-Submit Validation Errors",
open: function() {
console.log("4119 - On Open presubfields is: " + presubfields); // I see the presubfields variable and its text;
// $("#fielderrors div").html(presubfields);
// $("#fielderrors", {html:presubfields});
},
buttons: [
{
text: "Continue",
click: function() {
var button = $(this).prop("id");
console.log("4127 You clicked on:", button);
$(this).dialog("close");
},
},
{
text: "Show Fields",
click: function() {
var button = $(this).prop("id");
// Show the Fields requiring correction - div id = fielderrors
//var field_errors = $('#dialogpresubval').attr('note_text');
console.log("4143 - presubfields = " + presubfields); // console shows the correct information;
//$("#fielderrors").append(presubfields);
//$("#fielderrors", {html:presubfields});
$("#fielderrors").text("presubfields should be shown");
// Used this to test for generic text - $("#fielderrors").text("presubfields should be shown");
// $("#fielderrors").val(presubfields);
//$("#fielderrors").prop('display', 'block');
$("#fielderrors").css({'display':'block'});
$("#errordetail").hide();
},
},
{
text: "Show Details",
click: function() {
// Show the Details of the errors - div id = errordetail
// presubfields presubdetail
$("#errordetail").val(presubdetail);
$("#errordetail").show();
$("#fielderrors").hide();
},
}
],
position: {
my: "center center",
at: "center center"
}
});
});
I left in the commented out fields so you could see what I've tried already. I can't get the presubfields or presubdetail to display in the appropriate div.
What I want is that when the Show Fields button is pressed, the presubfields html is shown and the same for the presubdetail.
Thanks for looking.