Error Pup Up Dialog ASP.MVC 5
I am developing a modal window for my application.
I 'm doing all that is necessary for the display, but an error is generated at run-time.
I used two methods: data-role = " Dialog" and data-role = " Pupup " but both generate an error when running.
the error referred to preventDefault ();
Error Description : 0x800a01b6 - JavaScript runtime error : Object does not support property or method " preventDefault " ==> this error is generated during the use of data-role = " pupup".
During the use of data-role = " Dialog", no event is generated.
Related
I tested my website on lighthouse and I got this error does anyone knows how to fix it?
Links are not crawlable
This is my code share social media button
<a class="crunchify-link crunchify-facebook"
href="https://www.facebook.com/sharer/sharer.php?u=&t="
title="Share on Facebook"
rel="noopener"
target="_blank"
onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL)); return false;"
>
<div class="facebook-ic"></div>
</a>
Why did you get this warning?
Lighthouse tests for onclick="window.open to try and catch anchors that are activated by JavaScript instead of a href, as this is bad for SEO and accessibility.
Fixes / suggestions
If your href was valid I would say you could safely ignore this but it is not valid (empty "u" and "t" parameters).
Fix your href so that it is valid (build it server-side to populate the u and t parameters), you will still get the warning but it can be safely ignored then.
Although saying that if you fix the URL then target="_blank" will open the sharer in a new tab so that would be sufficient without the need for any JavaScript.
To remove the error you should move the event handler into a JavaScript file rather than using inline onclick handlers.
This will remove the warning after looking at the audit source code and is a good practice.
You can do this easily with target.addEventListener.
Quick example of event listeners
const el = document.getElementById("fbLink");
el.addEventListener("click", sharerFunction, false);
function sharerFunction(e){
e.preventDefault();
window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL));
alert("link will not open due to sandbox permissions, but check console it does fire");
}
<a href="https://facebook.com" id="fbLink" ....**other stuff here**....>Facebook icon</a>
Relevant part of audit source code for reference
As mentioned earlier the source code for the crawlable-anchors test shows what is tested for, anything returning true is a fail, notice how the hasClickHandler test returns null as that is considered ok (I believe, it is late I may have misread the code!).
const windowLocationRegExp = /window\.location=/;
const windowOpenRegExp = /window\.open\(/;
const javaScriptVoidRegExp = /javascript:void(\(|)0(\)|)/;
if (rawHref.startsWith('file:')) return true;
if (windowLocationRegExp.test(onclick)) return true;
if (windowOpenRegExp.test(onclick)) return true;
const hasClickHandler = listeners.some(({type}) => type === 'click');
if (hasClickHandler || name.length > 0) return;
if (rawHref === '') return true;
if (javaScriptVoidRegExp.test(rawHref)) return true;
I need to remove waitPopup() when "value required" error is displayed. (Correct errors before saving.)
Do you have any suggestions?
I have DA Before Page Submit:
$('body').append('<div class="apex_wait_overlay"/>');
vWait = apex.widget.waitPopup();
I already have remove when validation error appears. (jQuery Selector -> #APEX_ERROR_MESSAGE)
try{
vWait.remove();
$('body').children('div.apex_wait_overlay').remove();
}
catch(e){}
It would be nice if it was possible on ui dialog too.
waitPopup blocks clicking on dialog
Thanks
I am using bootstrap tokenfield to instrument my email textbox to support multiple email input.
User types letter a in the email textbox (the one with red font in the picture) . A list of matched emails show up in a selection menu (the box that shows the email abc#gmail.com in black)
After the user clicks and selected an email, the selected value is not captured. At the end I only got a letter a in the email textbox
How can I fix this issue?
It turns out I am also using Fastclick in my project. It swallowed the click event of the selection menu (of css class tt-selectable) used by bootstrap-tokenfield
At the end it is my solution. Fork the twitter typeahead.js project and change the following line from
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val,
that.displayFn(suggestion)).addClass(that.classes.suggestion + " "
+ that.classes.selectable);
to
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val,
that.displayFn(suggestion)).addClass(that.classes.suggestion + " "
+ that.classes.selectable + " needsclick");
The additional css class needsclick will disable fastclick on this elements
I am using kendo ui grid view and also use inline editing in NopCommerce.
now i want to check exist(for only one field) or not and if exist then not insert record in table this thing working fine.
but no any message display like "Record Already Exist" or "Error Happen".
and i see code of language resource string gird view and its working fine but i am not understand how to fire alert and display message as well.
please help me
There was a bug in nopCommerce 3.30 which did not properly display this error (fixed in the upcoming version 3.40).
You can return an error text the following way for grids:
return Json(new DataSourceResult() { Errors = "Your error text here" });
I'm using casperjs to get all jquery ui tabs on a page and clicking each one. The problem is that the tabs load dynamically and never seem to switch away from the "Loading..." state. I've tried using the casper wait() function and even the waitWhileSelector() function but neither seems to work:
function getActiveTab () {
var active_tab = $('#tabs>ul').find('li.ui-tabs-selected').text();
console.log("Active tab: " + active_tab);
return active_tab;
}
function clickTabs (tabs) {
this.each(tabs, function(casper, tab_name, i){
var child_number = i + 1;
var tab_selector = "#tabs>ul>li:nth-child(" + child_number + ")>a";
console.log(tab_selector);
// this.thenClick(tab_selector).waitWhileSelector('#tabs>ul>li.ui-state-processing', function(){
this.thenClick(tab_selector, function(){
var this_tab = this.evaluate(getActiveTab);
});
});
}
It seems to work for the first tab (because it's the one loaded on page load) but all the rest return "Loading":
------ snip passed tests ------
#tabs>ul>li:nth-child(1)>a
#tabs>ul>li:nth-child(2)>a
#tabs>ul>li:nth-child(3)>a
#tabs>ul>li:nth-child(4)>a
#tabs>ul>li:nth-child(5)>a
#tabs>ul>li:nth-child(6)>a
#tabs>ul>li:nth-child(7)>a
#tabs>ul>li:nth-child(8)>a
#tabs>ul>li:nth-child(9)>a
remote message caught: Active tab: Host Allocation
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#disk_pools_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#vvol_groups_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#arrayCablesTable').dataTable')
remote message caught: Active tab: Loadingâ¦
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#fa_information_table').dataTable')
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#zoning_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#pool_mismatch_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#other_information_table').dataTable')
remote message caught: Active tab: Loadingâ¦
Page Error: TypeError: 'undefined' is not a function (evaluating '$('#arrayIPs').dataTable')
remote message caught: Active tab: Loadingâ¦
FAIL 12 tests executed in NaNs, 11 passed, 1 failed.
When I use waitWhileSelector it times out after the first click. Most of the tabs dynamically load a script tag with a dataTables object and it would seem that either the table object never loads or the datatables library isn't loading? Do I have to inject that library into the evaluate method, or should the tag in the page pull it in anyway?
I'd appreciate any help to isolate what's happening in this test.
Need to include the .js files of datatables in the casperjs option: clientScripts.