|
Hi,
I'm starting to test the new Dynamics CRM 2011 ; i'd like to figure out whether it could be useful for our needs.
I'm facing a problem since a couple of days : in the previous version, I could customize the time-pickers to show different time interval (default is 30 minutes).
But I can't find the right syntax for the 2011 version.
Here's my script :
var schedstart = Xrm.Page.getAttribute("scheduledstart");
var interval = 15;
var timeField;
var tables;
var table;
var row;
var cell;
var time;
if (schedstart != null)
{
timeField = schedstart.all.time;
if (timeField != null)
{
tables = timeField.getElementsByTagName("table");
if ((tables != null) && (tables.length > 0))
{
table = tables[1];
while (table.firstChild != null)
{
table.removeChild(table.firstChild);
}
for (hour = 0; hour < 24; hour++)
{
for (min = 0; min < 60; min += interval)
{
row = table.insertRow();
cell = row.insertCell();
time = ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
cell.setAttribute("val", time);
cell.innerText = time;
}
}
}
}
}
The problem is on line timeField = schedstart.all.time; . I've been searching for a reference document about manipulating form elements, but none of them does talk about datetime fields. I got plenty of examples if I want to deal whith lookups, optionsets, text, etc. ; but complete blackout about datetime fields.
Does anyone have an idea about how to access the time-picker of a datetime field in javascript ?
Edit :
I found how to manage this requirement. Here's the code :
setTimeInterval: function (ctrl, interval)
{
var control = Xrm.Page.getControl(ctrl);
var timeField = control._control._element.children[0].children[1].all.time.children[1].firstChild;
var row;
var cell;
var time;
if (timeField != null)
{
while (timeField.firstChild != null)
timeField.removeChild(timeField.firstChild);
for (hour = 0; hour < 24; hour++)
{
for (min = 0; min < 60; min += interval)
{
row = timeField.insertRow();
cell = row.insertCell();
time = ((hour < 10) ? "0" : "") + hour + ":" + ((min < 10) ? "0" : "") + min;
cell.setAttribute("val", time);
cell.innerText = time;
}
}
}
}
Hope this will be useful to someone
|
|
|
|
|
|
Thanks for your reply. Unfortunately, it isn't a native HTML5 time field.
I'll keep trying to access the table cell where the combo box resides.
|
|
|
|
|
Any one know how to use the setdata on ajaxupload...pls help
|
|
|
|
|
|
hi ,
i just want to show calander on page.
how can i do it..?
|
|
|
|
|
|
You might also want to try this JQuery plugin. It provides you the power and ease of JQuery + support of the development community.
|
|
|
|
|
Why do so many people put all their javascript into just one line of code?
Is there a noticeable speed increase?
I also read that putting comments into your javascript slows it down. Is that really true?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
A minimized javascript file does load faster because it has fewer characters to transmit across the wire. Also why comments are removed, the javascript engine ignores them anyway. That's why you typically see two javascript files, like script.js and script.debug.js. the latter of course being used for debugging situations were it has full comments and formatting for readbility.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Unfortunately, the shadowbox source code does not include a "debug" file. They also use single-character variable names. It's virtually impossible to figure out what's being done and what it's doing it to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
A form of obfuscation
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
My answer is yes to all your questions. Removing unnecessary characters from javascript is known as minification and it does improve performance (I myself noticed this in one of my projects). Hence by the same logic removing comments will also improve performance.
Also this is one of the suggest best-practices by Yahoo.
|
|
|
|
|
I want to add browse for folder control in my web page.In HTML,browsing to the file level is there.But I need to browse the folder & want to get the complete path of that folder in web page.This folder can be in my local PC or can be in other pc in the network.Is this possible with java script or any other language???
I have to implement this feature anyhow.So any help is appreciated.If there is a solution in other languages like java,VC++ ,then please let me know.
Thanks in advance..
|
|
|
|
|
I don't believe there is a solution to this. The browser is of course using the capabilities of the client system and the default is for the FileOpen dialog, not the Folder dialog. To correct this you would need to install something on the client machine, very unlikely, or at the least use an ActiveX control, which is unlikely to be allowed either.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
new AjaxUpload("#fuCondition", {
action: servicesPath + 'Handlers/FileUpload.ashx?t=0&BRH_ID='+ $("#BRH_ID").val()+"&USR_ID="+ $("#USR_ID").val()+"&DeedOffice="+ $("#DeedOf").val(),
name: 'userfile',
data: {},
autoSubmit: true,
responseType: false,
onChange: function (file, extension) {
$("#fuCondition").hide();
$("#Uploading").show();
},
onSubmit: function (file, extension) {
if (!(extension && /^(rtf|zip)$/.test(extension))) {
alert('Error: file type not allowed.');
return false;
}
this.disable();
},
onComplete: function (file, response) {
$('#file_name').val(file);
if (response.toLowerCase() != 'true') {
$('#status').hide();
setTimeout(3000, 6000);
$("#Uploading").hide();
$("#fuCondition").show();
}
else if (response.toLowerCase() == 'false')
$('#status').html('error!, file not saved');
else
$("#status").html(response);
}
});
How to set the autosubmit to false, so that the plugin dsnt take defualt values of textbox? some links will be cool
modified on Thursday, April 21, 2011 8:42 AM
|
|
|
|
|
Please edit your post and format your code snippets using the "code block" toolbar item.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I have a textbox on my aspx page and a search button.
When I enter text in textbox and press search it populates the results in a jquery modal and on selection of one of the values returns me the data which gets mapped to various controls on the aspx page.
My issue is how do I send the textbox values to the service? I tried using on text_chnaged where I call the service and load the data into grid and on click of the button i call the div to open.
But this requires two clicks and is not a neat solution.. as every time i click the searhc button it loads an empy window and on next click opens a window with the populated grid.
please can you suggest how to overcome this. which even to be used load the data from service from
also how to enable paging in jquery grid.
|
|
|
|
|
Can you please provide snippet of code to GetData from web service and NextButton click to show window?
Thanks,
Imdadhusen
sunaSaRa Imdadhusen
+91 99095 44184
|
|
|
|
|
Hi,
I have a dropdown list populated with the list of names on my aspx page. I want to use this as a data source for autocomplete in the name textbox. Which is the best way to do it in jquery?!
Thanks,
|
|
|
|
|
|
I 've tried the following:
<script type ="text/javascript">
$(document).ready(function() {
var a = $("input#names").val();
$("#tags").autocomplete({
url: "CodeFile1.cs\SearchNames",
data: $("input#names").val()
});
});
</script>
<div class="ui-widget">
<label for="names">Names: </label>
<input id="names" />
</div>
and my codefile is :
public string[] SearchNames(string Name)
{
string [] Names = null;
int i;
i = 0;
ServiceClient serviceClient = new ServiceClient();
SearchResponse searchResponse = new SearchResponse();
principalSearchResponse = bondInformationServiceClient.SearchPrincipals(principalSearchRequest);
foreach (Name name in SearchResponse.NameList)
{
Names [i] = name .nameField.ToString().Trim();
i++;
}
}
return Names ;
}
gives me an runtime error: object expected.
|
|
|
|
|
I think you read the documentation on the autocomplete plugin wrong. If you wish to use an Url to load the autocomplete data from, which for as far as I've been able to figure out by your sample code you are, then you should return a plain text response with one possible word per line. And keep in mind it performs a round trip to the server, which means you will need to create a script file on the server (JSP, PHP, ASPX).
Look at http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions[^]
The documentation indicates the call to the server will contain the word to autocomplete in a parameter called 'q'.
|
|
|
|
|
Thanks Gerben, I read it again and understood what u mean!!..
I was just wondering if it's possible to use a wcf with it?
Also since this wcf is being used extensively and returns an object which is a list<objectnames>
thanks,
|
|
|
|
|
hi guys,
i have six(6) select controls all with values 1-6.
when i click submit in javascript i would like to check that a
select's value has not already been selected by the other five (5) selects.
can anyone please help me how i can do this, i have tried logic after logic
and yet still no joy at all...please help me.
i tried:
var ordercntr = false;
var partial = '';
var orderfinal = new Array();
for (l = 0; l < order.length; l++) {
partial += order[l] + '~';
var d = document.getElementById(order[l]).value;
if (partial.search(d) < 1)
{
orderfinal[l] = d; ordercntr = true;
}
else
{
ordercntr = false; break;
}
}
The logic works like a charm if the selected values in the selects are in the order 1-6
But fails badly if lets say the second(2) select has the value 5(or something else other than 2)
i know i have to revisit the entire logic but i have tried and now i'm asking
for help before i try forever.
I will appreciate any help.
Morgs
|
|
|
|