Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#5876 closed bug (notabug)

UI Dialog Form resulting in error

Reported by: DevlshOne Owned by:
Priority: critical Milestone:
Component: ui.dialog Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: http://co-mia-mlgen.mastec.local/js/jquery-1.4.2.min.js :: f :: line 132" data: no]

MAIN CODE:

<style type="text/css">
label, input { display: block; }
label { font-weight: bold; }
input.text { margin-bottom: 12px; width: 400px; padding: 0.4em; }
fieldset { padding: 0; border: 0; margin-top: 25px; }
h1 { font-size: 1.2em; margin: 0.6em 0; }
.validateTips { color: #F00; font-weight: bold; border: 1px solid transparent; padding: 0.3em; }
</style>
<script>
$(function() {
    var eng_email = '<?=getEngEmail($eng_id);?>';
    var part_number = $('#part_number'),
        part_desc = $('#part_desc'),
        part_reason = $('#part_reason'),
        allFields = $([]).add(part_number).add(part_desc).add(part_reason),
        tips = $('.validateTips');
	function updateTips(t) {
		tips
			.text(t)
			.addClass('ui-state-highlight');
		setTimeout(function() {
			tips.removeClass('ui-state-highlight', 1500);
		}, 500);
	}
    function checkLength(o,n,min,max) {
        if ( o.val().length > max || o.val().length < min ) {
            o.addClass('ui-state-error');
            updateTips("Length of " + n + " must be between "+min+" and "+max+".");
            return false;
        } else {
            return true;
        }
    }
    $('#new_part_form').dialog( {
        autoOpen: false,
        height: 300,
        width: 450,
        modal: true,
        buttons: {
            'Submit Request': function() {
                var bValid = true;
                allFields.removeClass('ui-state-error');
				bValid = bValid && checkLength(part_number,"Part Number",3,20);
				bValid = bValid && checkLength(part_desc,"Part Description",12,50);
				bValid = bValid && checkLength(part_reason,"Reason for Request",5,100);
                if (bValid) {
                    var strURL = "sendPartRequest.php";
                    $.get(strURL, {partNo:part_number,partDesc:part_desc,partReason:part_reason,engEmail:eng_email});
                    $(this).dialog('close');
                }
            },
            Cancel: function() {
        	    $(this).dialog('close');
            },
            Close: function() {
                allFields.val('').removeClass('ui-state-error');
            }
        }
    });
    $('#new_part_form_button')
        .button()
        .click(function() {
            $('#new_part_form').dialog('open');
    });
});
</script>
<div class="centered" id="new_part_form" title="New Part Request">
	<p class="validateTips">All fields are required!</p>
    <form>
    <fieldset>
    <label for="part_number">Part Number</label><br />
	<input type="text" name="part_number" id="part_number" class="text ui-widget-content ui-corner-all" />
    <label for="part_desc">Part Description</label><br />
	<input type="text" name="part_desc" id="part_desc" class="text ui-widget-content ui-corner-all" />
    <label for="part_reason">Reason for Request</label><br />
	<input type="text" name="part_reason" id="part_reason" class="text ui-widget-content ui-corner-all" />
	</fieldset>
	</form>
</div>
<div id="db_info"><a target="_blank" href="help/MLGen New Part Creation.pdf">What if my part number doesn't exist?</a></div>
<br />
<button class="centered" id="new_part_form_button">Request New Part Information from Procurement</button>

sendPartRequest CODE:

<?
$partNo = trim($_GET['partNo']);
$partDesc = trim($_GET['partDesc']);
$partReason = trim($_GET['partReason']);
$engEmail = trim($_GET['engEmail']);
$to = "ct_procurement@mastec.com";
$cc1 = $engEmail;
$cc2 = "david.mednick@mastec.com";
$cc3 = "william.womack@mastec.com";
$subject = "NEW PART REQUEST";
$message = "A new part has been requested to be added to Oracle:<br /><br />";
$message .= "Manufacturer's Part Number : ".$partNo."<br />";
$message .= "Part Description           : ".$partDesc."<br />";
$message .= "Reason for part request    : ".$partReason."<br /><br />";
$message .= "Please use <strong>REPLY ALL</strong> after this part has been researched. Thank you!<br /><br />";
require_once("email.extendclass.php");
$pr_email = new MLGenMail();
$pr_email->IsMail();
$pr_email->SetFrom('mlgen@mastec.com','Material List Generator');
$pr_email->Subject = $subject;
$pr_email->AddAddress($to);
$pr_email->AddCC($cc1);
$pr_email->AddCC($cc2);
$pr_email->AddCC($cc3);
$pr_email->MsgHTML($message);
$pr_email->AddSig($message);
$mail_ok = $pr_email->Send();
if (!$mail_ok) {
    echo "<div class=\"db_error\">Part request research email failed!</div>";
    echo $pr_email->ErrorInfo;
} else {
    echo "<div id=\"db_info\">Part request research email success!</div>";
}
?>

Change History (2)

comment:1 Changed 9 years ago by Scott González

Resolution: invalid
Status: newclosed

Please use the forums for help, or provide a reduced test case.

comment:2 Changed 7 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.