Index: /modules/branches/2.8/core/page.routing.php =================================================================== --- /modules/branches/2.8/core/page.routing.php (revision 9207) +++ /modules/branches/2.8/core/page.routing.php (revision 9215) @@ -679,13 +679,4 @@ changedClass: "text-red" }); - /*TODO: call clearPattern() here, or move this to routeEdit_onsubmit()? - */ - $("form").submit(function() { - $(this).find(".dpt-title").each(function() { - if($(this).val() == $(this).data("defText")) { - $(this).val(""); - } - }); - }); }); @@ -763,5 +754,4 @@ var msgInvalidRouteName = ""; var msgInvalidRoutePwd = ""; - var msgInvalidDialPattern = ""; var msgInvalidTrunkSelection = ""; var msgInvalidOutboundCID = ""; @@ -790,5 +780,7 @@ theForm.action.value = act; - return true; + + clearPatterns(); + return validatePatterns(); } @@ -799,4 +791,45 @@ } }); + return true; +} + +function validatePatterns() { + var one_good = false; + var culprit; + var msgInvalidDialPattern; + defaultEmptyOK = false; + + $(".toggleval").each(function() { + if ($.trim($(this).val()) == '') { + } else if (!isDialpattern($(this).val())) { + culprit = this; + return false; + } else { + one_good = true; + } + }); + + if (culprit == undefined && !one_good) { + culprit = $('.toggleval:visible').get(0); + msgInvalidDialPattern = ""; + } else { + msgInvalidDialPattern = ""; + } + if (culprit != undefined) { + // now we have to put it back... + // do I have to turn it off first though? + $(".dpt-title").each(function() { + if ($.trim($(this).val()) == '') { + $(this).toggleVal({ + populateFrom: "title", + changedClass: "text-normal", + focusClass: "text-normal" + }); + } + }); + return warnInvalid(culprit, msgInvalidDialPattern); + } else { + return true; + } } @@ -829,4 +862,5 @@ document.getElementById('reporoutekey').value=key; document.getElementById('action').value='prioritizeroute'; + clearPatterns(); document.getElementById('routeEdit').submit(); break;