Click here to Skip to main content
15,889,527 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Change webpage background on the fly (If it worked) Pin
Richard Deeming29-Jun-16 2:06
mveRichard Deeming29-Jun-16 2:06 
PraiseRe: Change webpage background on the fly (If it worked) Pin
Born5929-Jun-16 2:12
Born5929-Jun-16 2:12 
QuestionJSHint & Sublime use and config Pin
DavidMillar246828-Jun-16 21:00
DavidMillar246828-Jun-16 21:00 
AnswerRe: JSHint & Sublime use and config Pin
Richard MacCutchan28-Jun-16 21:20
mveRichard MacCutchan28-Jun-16 21:20 
AnswerRe: JSHint & Sublime use and config Pin
Kornfeld Eliyahu Peter28-Jun-16 22:55
professionalKornfeld Eliyahu Peter28-Jun-16 22:55 
QuestionConfirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx23-Jun-16 12:35
professionaljkirkerx23-Jun-16 12:35 
AnswerRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
Graham Breach23-Jun-16 23:17
Graham Breach23-Jun-16 23:17 
GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx24-Jun-16 6:10
professionaljkirkerx24-Jun-16 6:10 
It's not the actual code, just an example. I did some searching before my post and tested some other thoughts. Some thoughts talked about it being an async function and the code just ran through.

The code is pretty large in size, but I will post it. It's all on one page or external script file.

I did test it compressed and uncompressed thinking that my gulp script that compresses the script for production use was making an error of some sort.

The only thing that I can think of is a bug in Firefox, but I doubt that!
$(document).ready(function () {

     $("#sectionDelete").click(function () {
        $("#sectionForm").validate({
            ignore: "",
            errorClass: 'input-validation-error',
            rules: {
                Section_DeptID: {
                    required: true,
                    minLength: 1
                },
                Section_SectiontID: {
                    required: true,
                    minLength: 1
                },
                Section_Name: {
                    required: true,
                    minLength: 2
                },
                Section_Desc: {
                    required: true,
                    minLength: 2
                }
            },
            messages: {
                Section_Name: 'Section requires a name',
                Section_Desc: 'Section requires a description'
            },
            highlight: function (element, errorClass) {
                $(element).addClass(errorClass);
            },
            unhighlight: function (element, errorClass) {
                $(element).removeClass(errorClass);
            },
            success: function (result) {
                if (result === "1") {
                    return true;
                }
                else {
                    return false;
                }
            }
        });
        if ($("#sectionForm").valid()) {
            var deptID = parseInt($("#Section_DeptID").val()),
                sectionID = parseInt($("#Section_SectionID").val());
            if ((isNaN(deptID) || deptID === -1) && (isNaN(_sectionID) || sectionID === -1)) {
                $("#selectSection").text('You must select a section first!').addClass('text-danger');
            }
            else {
                sectionDelete();
            }
        }<br />
    });

});
This is the function that is called from above.
function sectionDelete() {

    var $e_Section_DeptID       = $("#Section_DeptID"),
        $e_Section_SectionID    = $("#Section_SectionID"),
        $e_Section_Name         = $("#Section_Name"),
        $e_sContainer           = $("#Section_Container"),
        _deptID                 = parseInt($e_Section_DeptID.val()),
        _sectionID              = parseInt($e_Section_SectionID.val()),
        _name                   = $e_Section_Name.val(),
        _confirm                = confirm('Are you sure you want to delete the section ' + _name);

     if (_confirm === true) {
        $e_sContainer.empty().append(pWait);
        $.ajax({
            type: "POST",
            cache: true,
            dataType: "json",
            url: '/Ajax/json_section_delete',
            data: { DeptID: _deptID, SectionID: _sectionID },
            error: function (response) {
                debugger;
                thisObj.toggleClass('active');
                alert("http code: " + response.status + " Error: json_sections_load - data: " + response);
            },
            success: function (data) {
                if (data.length === 0) {
                    $e_sContainer.empty().append(pNull);
                }
                else {
                    var sections = '<ul class="nav nav-pills nav-justified">';
                    for (var x = 0; x < data.length; x++) {
                        if (data[x].Enabled === true) {
                            sections += '<li class="col-xs-3" style="width: 33%; float: left; margin: 1% 0;"><button class="section btn btn-success btn-sm" title="' + data[x].Description + '" data-val="1" onclick="sectionRecordLoad(this, ' + data[x].SectionID + '); return false;" type="button">' + data[x].Name + '</button></li>';
                        }
                        else {
                            sections += '<li class="col-xs-3" style="width: 33%; float: left; margin: 1% 0;"><button class="section btn btn-warning btn-sm" title="' + data[x].Description + '" data-val="0" onclick="sectionRecordLoad(this, ' + data[x].SectionID + '); return false;" type="button">' + data[x].Name + '</button></li>';
                        }
                    }
                    sections += '</ul>';
                    $e_sContainer.empty().append(sections);
                }
            }
        });
     }     
}

GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
Graham Breach24-Jun-16 23:54
Graham Breach24-Jun-16 23:54 
GeneralRe: Confirm always returning false on Firefox for IOS Ver 4.0 Pin
jkirkerx26-Jun-16 9:01
professionaljkirkerx26-Jun-16 9:01 
QuestionJQuery Validator, rules highlight creates label under textbox that is wrong class. Pin
jkirkerx22-Jun-16 9:34
professionaljkirkerx22-Jun-16 9:34 
AnswerRe: JQuery Validator, rules highlight creates label under textbox that is wrong class. [solved] Pin
jkirkerx22-Jun-16 12:34
professionaljkirkerx22-Jun-16 12:34 
GeneralMultidimensional Array in JavaScript Pin
HubSnippets22-Jun-16 2:05
HubSnippets22-Jun-16 2:05 
AnswerRe: Ajax succees event not firing with jsonp Pin
Peter_in_278021-Jun-16 17:23
professionalPeter_in_278021-Jun-16 17:23 
QuestionJquery Row details open Pin
Member 1130579120-Jun-16 3:31
Member 1130579120-Jun-16 3:31 
QuestionHow to compute XOR logic? Pin
AmalRaj@Sync19-Jun-16 19:05
AmalRaj@Sync19-Jun-16 19:05 
AnswerRe: How to compute XOR logic? Pin
Richard MacCutchan19-Jun-16 21:41
mveRichard MacCutchan19-Jun-16 21:41 
AnswerRe: How to compute XOR logic? Pin
Kornfeld Eliyahu Peter19-Jun-16 23:37
professionalKornfeld Eliyahu Peter19-Jun-16 23:37 
AnswerRe: How to compute XOR logic? Pin
Richard Deeming20-Jun-16 1:50
mveRichard Deeming20-Jun-16 1:50 
QuestionLooking for tutorial or code to learn from, display only certain XML records Pin
bulrush40010-Jun-16 3:29
bulrush40010-Jun-16 3:29 
AnswerRe: Looking for tutorial or code to learn from, display only certain XML records Pin
John C Rayan14-Jun-16 4:55
professionalJohn C Rayan14-Jun-16 4:55 
Questionhow to hide web browser toolbar and show web page with fullscreen Pin
njzt3-Jun-16 5:39
njzt3-Jun-16 5:39 
AnswerRe: how to hide web browser toolbar and show web page with fullscreen Pin
Richard Deeming3-Jun-16 7:14
mveRichard Deeming3-Jun-16 7:14 
GeneralRe: how to hide web browser toolbar and show web page with fullscreen Pin
njzt3-Jun-16 18:33
njzt3-Jun-16 18:33 
GeneralRe: how to hide web browser toolbar and show web page with fullscreen Pin
njzt6-Jun-16 1:55
njzt6-Jun-16 1:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.