attributes

Is there a Rails way to check which attributes have been updated in an observer?

I have an ActivityObserver, which is observing tasks, and has an after_update callback. I want to test if a particular attribute has been modified in the update. Is there a Rails way to compare the attributes of the subject with what they were before the update, or to check if they have changed? ...

Can an HTML form action attribute be repeated ?

I have an application that generates a element with an 'action' attribute. I need to change the value of the action attribute, but it's not possible to do that. However it is possible to add another 'action' attribute before the generated one thusly: This seems to work for IE. I'd like to know if this behavior is defined in the w3c ...

Choice of Attribute(s) on XML instance for directly defined attributes or references

Hello, I'm looking for a variant of choosing an attribute for an element, that can be directly set or be referenced. this is what I have in Mind: <root> <element> <attribute ref="shortname" /> </element> <element> <attribute name="shortname" isEditable="true" anotherattrib="0815" /> </element> </root> Since this wouldn't ...

Get instance of ActionFilterAttribute in the method

I am newbie in ASP.NET MVC platform and I faced with the following problem. I am using ActionFilterAttribute to do some routine work before and after action method run. The problems is that I need to get instance of the attribute in action method to read some properties which was set in OnActionExecuting method. For example public cl...

JavaScript setAttribute vs .attribute=

Hello! Is there a best-practice indication about using setAttribute instead of the dot (.) attribute notation? e.g. myObj.setAttribute("class","nameOfClass");      - and - myObj.className="nameOfClass"; OR myObj.setAttribute("id","someID");      - and - myObj.id="someID"; etc Thank you. ...

Is it possible to insert jQuery variable on an element's attribute?

Hi, I got just want to ask if its possible to insert a jQuery variable on an attribute. Here is a sample code: <html> <head> <script type="text/javascript"> $(function() { var url = 'http://www.google.com'; var data = '?one=1&two=2&three=3'; }); </script> </head> <body> <a href="jquery var">Click here</a> </body...

Validating content of the attributes to not be the same

Hey everybody, I am trying to write a unit testing for a User model in Ruby on Rails. I am using authlogic and need to check that the first_name and last_name of the user model attributes are not the same when the user is registering. This is my user model: class User < ActiveRecord::Base acts_as_authentic do |c| c.login_field= ...

HTML tags and attributes sored in xml file

Hi, Does anyone own or knows where can i find a xml file containing all the HTML tags and attributes? Thanks. ...

Conditionally parsing XML attributes with PHP

Hi, I am really hoping somebody can help me with this. Basically, I am trying to parse certain XML attributes in an XML tree based on other attributes in that branch. As an example of the type of XML I am working with: - <root> <employees> <team id="1643"> <member id ="153461" jobtype="permament" division="cleaning" rollnumber=...

What is the most general python type to which I can add attributes?

Hi, I have a class Foo with a method isValid. Then I have a method bar() that receives a Foo object and whose behavior depends on whether it is valid or not. For testing this, I wanted to pass some object to bar whose isValid method returns always False. For other reasons, I cannot create an object of Foo at the time of testing, so I ...

accepts_nested_attributes and validates_uniqueness_of

The central problem: How do you merge attribute collections by a key during mass assignment from a nested form. The details: I am using the following models: class Location < ActiveRecord::Base has_many :containers, :dependent => :destroy, :order => "container_type ASC" validates_associated :containers accepts_n...

jQuery .attr('type', 'submit') on a button element giving me a strange error in IE7

I'm parsing a JSON response via $.ajax() and building a form from this object's values. The script I've written is long, but here's what it's doing: Dynamically creating: ~ a form element, ~ a fieldset element, ~ a button element, ~ 20 or so text inputs and label elements Appending the inputs and labels to the fieldset Appending the b...

How do I have to add a Manufacturers in Magento

Hi guys, How do I have to add the Manufacturers Attribute in Magento using php? Thanks ...

Retrieve form's "name" attribute in Javascript whereas an input exists with name "name"

Hi there ! I have something like this HTML structure : <form name="myvalue" id="hello"> <input type="text" name="name" /> </form> I'd like to retrieve the form's name attribute in Javascript, with a cross browser solution. Obviously, document.getElementById("hello").name won't work because it will return the corres...

jquery, grab the link href attribute that was last clicked: making a "follow to external link or don't follow".

I'm making a tiny script that adds a class of "external" to all external links, then when someone click an external link, it shows a div.question-wrapper that has a div.follow and a div.dontfollow in it, it also displays the url of the link you clicked in the div.question-wrapper. the only problem i'm having is copying the href attr of t...

How to preserve whitespaces in attributes values when using XDocument?

I process xml which contains tabs ("\t") and line breaks ("\n") in its attributes values. When I parse it using XDocument.Parse(), the tabs and line breaks are converted to spaces, even with the LoadOptions.PreserveWhitespace parameter. How can I get a XDocument with original attributes values? ...

javascript - get custom attribute based on an id

How can I find the seq number given the id in this example? <table> <tr class="row_header thin_border"> </tr><tr id="id33192010101533333" seq="2"> <td>20101015</td> <td>600</td> <td>730</td> <td><a href="#" onclick="deleteActivity(3319,20101015,1);">Click</a></td> <td><a href="#" onclick='selectEditActi...

Can Attributes be used for automatic change notification/logging?

Is there a way to do this: class Example { [ChangeNotification] private int field; } Such that changing the value of "field" would automatically get logged, generate an event, etc? ...

jquery and attr, undefind

Hi, Whats wrong with my code? Why does .atrr() show empty? Thanks $(document).ready(function(){ $('#push').click(function(){ alert($('#push2').attr('href').val); }); }); HTML: <div id="push">PUSH</div> <a id="push2" href="http://www.google.com"&gt;PUSH Google</a> ...

Replace part of an HREF attribute in a link with jQuery

I'm new to jQuery and I need to replace a part of an A HREF attribute in a link. More specifically, a piece of code that will remove the "-h" from "s1600-h" for a lightbox application: In other words, turn s1600-h to s1600 Also, do I need to use $(function() or $(document).ready(function() before the piece of code? Thanks ...