Hallo all.
I need to set a maximum widht to a label tag and avoid the text overflow with jquery.
Is there an elegant way to do it?
Kind regards
Massimo
When I use
$(document).ready(function() {
var bodyHeight = $("body").height();
console.log(bodyHeight);
});
I get a really wack number for body height. I then run
$("body").height();
in the console and get the right height. Something seems fishy about the $(document).load doing this... Yes my CSS works fine and all, so is this my bug, chromes, or jQuery's?
After publishing a new build of my ASP.NET MVC web application, I often see this exception thrown when browsing to the site:
System.Web.Mvc.HttpAntiForgeryException: A required anti-forgery token was not supplied or was invalid. --- System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. --- System.Web.UI.ViewStateException: Invalid viewstate.
This exception will continue to occur on each page I visit in my web application until I close out of Firefox. After reopening Firefox, the site works perfectly. Any idea what's going on?
Additional notes:
I am not using any ASP.NET web controls (there are no instances of runat="server" in my application)
If I take out the <%= Html.AntiForgeryToken % from my pages, this problem seems to go away
I am using jaxb for my application configurations
I feel like I am doing something really crooked and I am looking for a way to not need an actual file or this transaction.
As you can see in code I:
1.create a schema into a file from my JaxbContext (from my class annotation actually)
2.set this schema file in order to allow true validation when I unmarshal
Schema mySchema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaFile);
jaxbContext.generateSchema(new MySchemaOutputResolver()); // ultimately creates schemaFile
Unmarshaller u = m_context.createUnmarshaller();
u.setSchema(mySchema);
u.unmarshal(...);
do any of you know how I can validate jaxb without needing to create a schema file that sits in my computer?
Do I need to create a schema for validation, it looks redundant when I get it by JaxbContect.generateSchema ?
How do you do this?
I want to replace a form element with a div and keep the inner html of the form inside the inserted div element. i tried jquery it gives me unkown html element as selection result,
below is the target form and inner html:
thank you .
I have found many ways to measure width and to truncate text using jquery, but I can't find one based on height.
I am limited to two lines of text or it will knock my design out of canter.
So does anyone know a method of limiting a paragraph to two lines high, tuncating it and adding an elipse ?
I use jquery blockUI plugin (v2) and call $.blockUI when user submits a form. Web page smoothly fades out and new page appears. That's ok. But when user presses "back" button in opera/fire fox he observes fade out page with hourglass mouse cursor that is completely blocked.
Chrome/IE visualize page ok.
What would you suggest?
Thank you in advance!
I have marked certain properties in my domain object for the
nhibernate validation 'framework'.
If I do this in my controller explicitly:
ICollection<IValidationResult> test = bla.ValidationResults();
I get the validation errors which I could add to my asp.net mvc
modelstate
ideally, i would like an exception being thrown during:
bla = blaRepository.SaveOrUpdate(bla);
if i try to save or update the domain object. why is this not
happening? my domain object bla derives from Entity.
do I have to register something somehow?
Thanks.
christian
I'm a noob with jQuery...and I hope I've explained this well enough; I have a <ul> header that appears when I've added an entry to a dynamically created list using $.post. Each entry added has a delete/edit button associated with it.
Header is this:
<ul class="header">
<li>Month</li>
<li>Year</li>
<li>Cottage</li>
</ul>
My dynamic list that is created:
<ul class="addedItems">
<li>Month</li>
<li>Year</li>
<li>Cottage</li>
<li><span class="edit">edit</span></li>
<li><span class="del">delete</span></li>
</ul>
This all looks like this:
Month Year Cottage <--this appears after I've added an entry
-------------------------------- and I want it to stick around unless
all items are deleted.
Dec 1990 Fir edit/delete <--entries
Jan 2000 Willow edit/delete
My question is: Is there some kind of conditional that I can use with jQuery to hide the class="header" if all the items are deleted? I've read up on conditional statements like is and not with jq but I'm not really understanding how they work. All of the items in class="addedItems" is stored in data produced by JSON.
This is the delete function:
$(".del").live("click", function(){
var del = this;
var thisVal = $(del).val();
$.post("delete.php", { dirID : thisVal },
function(data){
if(confirm("Are you sure you want to DELETE this entry?") == true) {
if(data.success) {
//hide the class="header" here somwhere??
$(del).parents(".addedItems").hide();
} else if(data.error) {
// throw error if item does not delete
}
}
}, "json");
return false;
}); //end of .del function
Here is the delete.php
<?php
if($_POST) {
$data['delID'] = $_POST['dirID'];
$query = "DELETE from //tablename WHERE dirID = '{$data['delID']}' LIMIT 1";
$result = $db->query($query);
if($result) {
$data['success'] = true;
$data['message'] = "Entry was successfully removed.";
} else {
$data['error'] = true;
$data['message'] = "Item could not be deleted.";
}
echo json_encode($data);
}
?>
I have an object that I want to send with my jquery.ajax function but I can't find anything that will convert it to the serialized format I need.
$.ajax({
type: 'post',
url: 'www.example.com',
data: MyObject,
success: function(data) {
$('.data').html(data)
}
})
MyObject = [
{
"UserId": "2",
"UserLevel": "5",
"FirstName": "Matthew"
},
{
"UserId": "4",
"UserLevel": "5",
"FirstName": "Craig"
}
]
Hi,
I've got some cells in an Excel doc populated from a named range (data/validation/list source=MyNamedRange)
My problem is the following: I'd like to change a value in the named range, then see this value updated in my whole doc.
It might be performed through a macro, but I don't know how to code this.
Any hints please?
Thanks,
I have a fair knowledge about Javascript, I started with jQuery 1.4 a week back and I have gone through some examples. It's very interesting to use it with my application. But my concern is, should I care about previous versions? Should I know what the downsides are of the previous version?
I have a VB.Net 1.1 application works just fine after compiling in Visual Studio. However, I want to use ILMerge to combine all the referenced assemblies into a single executable just to make it easier to move around. After I send it through ILMerge and try to run it I get the error
"Strong name validation failed for .exe" .....
But none of my stuff is strong named! I saw this post here: http://stackoverflow.com/questions/403731/strong-name-validation-failed and tried running it through 'sn.exe -Vr .exe' but that gives me this error:
".exe does not represent a strongly named assembly"
Has anyone else had this problem before? How do I fix it?
Consider these jquery statements...
$(document).ready(function() {
getRecordspage(0, itemsPerPage);
$(".pager").pagination(maxNumberOfElementsHere, {
//my def
});
});
I get the value for maxNumberOfElementsHere from getRecordspage function... How to pass that value from getRecordspage function to the next one $(".pager").pagination(maxNumberOfElementsHere.... Any suggestion...
Hi All, I tried to ask this question on the jquery tools forum, but didn't get a response, hopefully someone here can help.
Question:
It seems the onClick event does not get fired when user is already on current tab, I think that make sense for most cases. However, in my case, I do want to capture the onClick event even when the curent tab is already the selection.
Is there a way to do this?
Thanks!
My problem is this: I need to update some text in a div with the value of what the mouse pointer is hovering over in the autocomplete drop down list.
Can it be done easily, or do I have to make fundamental changes to the Autocomplete plugin?
I am using the jQuery Autocomplete plugin version 1.1 by Jörn Zaefferer.
Any and all help will be greatly appreciated!
I have the following model with a virtual attribute
class Mytimeperiod < ActiveRecord::Base
validates presence of :from_dt
validates_format_of :from_dt, :with => /\A\d{2}\/\d{2}\/\d{4}\Z/, :message => "format is mm/dd/yyyy"
def from_dt
self.from_date.strftime("%m/%d/%Y") if !self.from_date.blank?
end
def from_dt=(from_dt)
self.from_date = Date.parse(from_dt)
rescue
self.errors.add_to_base("invalid from dt")
end
end
I am using <%= f.error_messages %> to display the error messages on the form.
I am using from_dt as a virtual attribute (string). The 'presence of' and 'format of' validation errors show up on the form, but when the user enters an invalid date format on the form and Date.Parse raises an exception I have a 'errors.add_to_base' statement in the rescue clause. Can anyone tell me why this error does not show up in the form error messages when I disable the 'format of' validation.
thanks.
Hi,
I have seen many resources on using jQuery with rails where people recommend having callback functions in .js.erb files, however I have also heard that passing data this way leaves me vulnerable to man in the middle attacks. Is this true? What are the security concerns and is there a way to do it safely?
Thanks
I am using json data and iterating it through jquery and displaying my results...
Using var jsonObj = JSON.parse(HfJsonValue); works in firefox but not in IE6....
HfjsonValue is a json string which is returned from my aspx code behind page... SO i dont use ajax... Any suggestion to get my json parsed better and cross browser one...
Hello guys,
I wanted to write javascript code on "OnClientClick" of the asp.net button and also I want the asp.net validation to be run for that button. but when i mix these both validation is not working. please help me out. Below is my code
ASPX
<asp:Button ID="btnAddToFeatureOffers" runat="server" Text="Add to Feature Offers"
OnClick="btnAddToFeatureOffers_Click" ValidationGroup="vgAddOffer" OnClientClick="add();" />
javascript
function add() {
var selectedOrder = $('#ctl00_MainContent_ddlFeaturedHostingType option:selected')[0].index;
var offer = $('#<%=txtOrder.ClientID%>').val();
var a = $("<a>").attr("href", "#").addClass("offer").text("X");
$("<div>").text(offer).append(a).appendTo($('#resultTable #resultRow td')[selectedOrder - 1]);
}
I used jquery stepcarousel plugin for my gallery in my application it works but what happens is when i navigate through images i can see new image flickers for few seconds and then shows up.... Any tips to avoid it....
Hi,
Ive got this in an XML file that i parse with JQuery.
<title>Lång</title>
I'm using .text() for pulling out the text, but it's wrong encoded.
How do I get it encoded to proper text? I want 'Lång' out of it.
I am trying to use the jQuery SimpleModal plugin and I am curious about something: The description page mentions a "container" div. What is the purpose of this? Do I need to use it to use the plugin?
I'm getting the following validation error on my layer diagram
Error 65 AV0001 : Invalid Dependency : Weld.Interface.Core(Assembly) -- Weld.Interface(Namespace)
Layers: Application Framework Core, Application Framework | Dependencies: Namespace Reference D:\Projects\Windows Projects\Weld\Weld\ModelingProject1\Weld.layerdiagram 0 0 ModelingProject1
Weld.Interface.Core: This assembly and namespace does not have a reference to Weld.Interface and only references .NET Framework classes
Weld.Interface: This assembly and namespace does not have a reference to Weld.Interface
There is no dependancy between these two layers in the dependency diagram. I am confused why I am getting this error. No dependency in the project or code, and no dependency is even setup in the layer diagram.
Somehow the Validation logic in the layer diagram is seeing a non existant dependency and saying it is an error.
Any ideas what either I might have missed or what is causing this problem?
Is it a good idea to learn JavaScript before learning a JavaScript framework library such as jQuery, Prototype, etc.?
Sometimes I find myself struggling because I feel I don't know JavaScript as well as I should.