Edit hyperlink validation - validation

Is there any possibility to add another protocol to the hyperlink-type in sharepoint?
I want to add a notes (notes://***) to the top level navigation-bar.
Is there something I can extend or where I can edit the validation

By default, SharePoint navigation Hyperlinks must begin with http://,https://,mailto:,ftp://,file://,/,# or \.
If you want to use the "notes://***", as a workaround, you can add the link using jQuery code.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".ms-core-listMenu-horizontalBox>ul>li>ul").append("<li class='static'><a href='notes://xxx'>MyNote</a></li>");
});
</script>

Probably it is not possible to turn off easily the OOB link validation without any customization. Depends on the output You need maybe You could use a note column and in edit HTML content of the filed just put the link tag manually like:
someLink
. After save SharePoint will render it as link on list webpart.

Related

Adding javascript function to a grocerycrud add or edit form

Is it possible to add a javascript function to the add/edit forms of grocery_CRUD?
E.g. As a user is typing in a particular field when adding or editing a record I want to execute a javascript on the keydown event.
If so, how?
It is possible.
For example, you call the view like this:
$this->load->view('grocery_crud_view', $output);
In the beginning of the view (grocery_crud_view.php), you can add any javascript
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascrpt">
$("#field-code").keyup(function(){
alert("there is a keyup");
});
</script>
<?php
// The rest of default php code
?>
Most of the id of the grocery-CRUD view (if you use flexigrid theme) would be something like this : "field-your_field_name"
You can inspect with firebug or google-chrome developer tools to ensure it.

Custom CSS for Google Custom Search Engine

How can I customize CSS for Google Search Engine. Currently I use a theme:
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1',
{language : 'en', style : google.loader.themes.ESPRESSO});
.....
But I want to change the font colors/sizes.
On the official guide https://developers.google.com/custom-search/docs/js/cselement-devguide
I see a link:
Modify result CSS properties - The Custom Search element uses Search Control result styles, which you can modify to change basic look and feel.
Which is broken (leads to 404). Surfing the Internet didn't bring results. Is there a way to do that?
They just moved it under another URL but forgot to update it in their documentation:
was
https://developers.google.com/apis/websearch/docs/#StylingSearchResults
became
https://developers.google.com/web-search/docs/#StylingSearchResults

jQuery conflict while using jslider with prototype and noConflict

Trying to resolve $ conflict between prototype.js and jQuery.js because I need to use jSlider which requires the jQuery library.
I add jQuery.noConflict() at the end of the jquery.js file then in the jslider.js file I change $._roundNumber to jQuery._roundNumber. Yet I still get an error which says jQuery._roundNumber is not a function. Please help.
Here is the example of integrating prototype and jquery...May check you did the right thing or not.?
<script src="prototype.js"></script>
<script src="effects.js"></script>
<script src="jquery.js"></script>
jQuery.noConflict();
jQuery(document).ready(function($){
jQuery("a").click(function(){
Effect.Shake('shake_demo');
});
});
<div id="shake_demo" style="width:150px; height:40px; background:#ccc; text-align:center;">
Click me to shake!
</div>
And now for rounding the number you can use this code:
var txt=jQuery('#txtBox').val());
var amt = parseFloat(txt);
alert(amt.toFixed(2);
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number/toFixed
Fixed. Just realised that the reason jQuery.noConflict() was not working was because jQuery was already being used in the template page that I was including in my current page so the problem was two fold:
'$()' which is the default jQuery selector was clashing with prototype.js which Tapestry includes by default
when I added jQuery.noConflict() at the end of my jquery.new.js file then tried using 'jQuery()' as the selector it did not work either because a different version of jquery (let's call this jquery.old.js) was already included in the template page (which I was including in my current page). To get the jquery.old.js to work with prototype.js, the previous developer already used jQuery.noConflict() so the 'jQuery()' selector was already taken as well.
Fix: I added $j2 = jQuery.noConflict() at the end of jquery.new.js file then I used '$j2()' selector in my new library that uses the jSlider and I also modified the selector in the jSlider.js file. It all works well now.
I am leaving both jquery.new.js and jquery.old.js file in the project (rather than using just one) because the template page which uses the older jquery version is used all over the site (I don't want to test the entire site after changing this) while the new component I'm adding needs the new version of jquery (jquery.new.js) file. And yes I know it's better to add the no conflict commands at the top of my html page rather than at the end of the js library files - will change that after this update on stack overflow :)

Add Infinity Scroll Down in Joomla

How do I integrate Jquery code for Infinity/Autopager Scroll down in Joomla. And If possible the scroller to work on Chosen Articles.
if you want to add jQuery into your joomla made site then it is easy to load a jquery file like:
Add the following codes into your index.php file you will find this file in your template directory like : joomla/templates/rhuk_milkyway/index.php now simple open it and add the following code after <link> tab
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
now before starting your own jquery codes it is must to make your codes without conflicting with mootools and other, and for this just simple add jQuery.noConflict(); and place jQuery instead of $ for example:
<script>
jQuery.noConflict();
// now your codes like
jQuery('#someid').each(function(i, e){});
</script>

Why does form validation not work in MVC3 partial views?

Anybody? There is another question regarding this but the only answers were to code up some javascript validation, which also refuses to work on my partial view ("$ is not defined").
Anyway, I don't want to use javascript I just want simple validation for required fields that cannot be left blank, number fields that require ints, etc.
Can anyone shed some light on validation and partial views?
I suspect that you are loading those partial views using AJAX. If this is the case you will need to manually invoke the $.validator.unobtrusive.parse method once you inject the new contents of the partial into the DOM as explained in this article.
Brad Wilson also discussed this in his blog post:
The unobtrusive client validation script automatically parses the
initial set of HTML for validation rules when the page has finished
loading. If your page dynamically adds new HTML content (perhaps
throught Ajax or through client-side application code), you may wish
to parse that new HTML for client validation on the new HTML elements.
To parse new HTML, you can call the
jQuery.validator.unobtrusive.parse() method, passing it a selector for
the HTML that you would like to be parsed. You can also call the
jQuery.validator.unobtrusive.parseElement() function to parse a single
HTML element.
As far as the $ is not defined error you should make sure that you have included the proper scripts:
<script src="#Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
Also make sure you are not referencing any of the Microsoft*.js scripts. They are obsolete and should no longer be used in ASP.NET MVC 3.
Of course that's only a supposition, you haven't shown any code so we cannot know what you are doing.
I'm having the same problem and i found that it's not possible to call $.validator.unobtrusive.parse() on the same form twice.
When loading the form initially from the server the form is parsed automatically by the unobtrusive library. When you add an input element dynamically to the form and call $.validator.unobtrusive.parse() again, it won't work. The same goes for parseElement().
So before you call $.validator.unobtrusive.parse, remove the original validator and unobtrusive validation from the form like so:
success: function (html) {
$("#div-id").append(html);
var form = $("#div-id").closest("form");
form.removeData('validator');
form.removeData('unobtrusiveValidation');
$.validator.unobtrusive.parse($("#editorRows"));
}

Resources