Search Results

Search found 5872 results on 235 pages for 'authorize attribute'.

Page 41/235 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Best Practice: Access form elements by HTML id or name attribute?

    - by seth
    As any seasoned JavaScript developer knows, there are many (too many) ways to do the same thing. For example, say you have a text field as follows: <form name="myForm"> <input type="text" name="foo" id="foo" /> There are many way to access this in JavaScript: [1] document.forms[0].elements[0]; [2] document.myForm.foo; [3] document.getElementById('foo'); [4] document.getElementById('myForm').foo; ... and so on ... Methods [1] and [3] are well documented in the Mozilla Gecko documentation, but neither are ideal. [1] is just too general to be useful and [3] requires both an id and a name (assuming you will be posting the data to a server side language). Ideally, it would be best to have only an id attribute or a name attribute (having both is somewhat redundant, especially if the id isn't necessary for any css, and increases the likelihood of typos, etc). [2] seems to be the most intuitive and it seems to be widely used, but I haven't seen it referenced in the Gecko documentation and I'm worried about both forwards compatibility and cross browser compatiblity (and of course I want to be as standards compliant as possible). So what's best practice here? Can anyone point to something in the DOM documentation or W3C specification that could resolve this? Note I am specifically interested in a non-library solution (jQuery/Prototype).

    Read the article

  • How to compare dictonary key with xml attribute value in xml using LINQ in c #?

    - by Pramodh
    Dear all, i've a dictonary " dictSample " which contains 1 data1 2 data2 3 data3 4 data4 and an xml file"sample.xml" in the form of: <node> <element id="1" value="val1"/> <element id="2" value="val2"/> <element id="3" value="val3"/> <element id="4" value="val4"/> <element id="5" value="val5"/> <element id="6" value="val6"/> <element id="7" value="val7"/> </node> i need to match the dictonary keys with the xml attribute id and to insert the matching id and the value of attribute"value" into another dictonary now i'm using like: XmlDocument XDOC = new XmlDocument(); XDOC.Load("Sample.xml"); XmlNodeList NodeList = XDOC.SelectNodes("//element"); Dictionary<string, string> dictTwo = new Dictionary<string, string>(); foreach (string l_strIndex in dictSample .Keys) { foreach (XmlNode XNode in NodeList) { XmlElement XEle = (XmlElement)XNode; if (dictSample[l_strIndex] == XEle.GetAttribute("id")) dictTwo.Add(dictSample[l_strIndex], XEle.GetAttribute("value").ToString()); } } please help me to do this in a simple way using LINQ

    Read the article

  • ASP MVC C#: Is it possible to pass dynamic values into an attribute?

    - by wh0emPah
    Okay I'm very new to C# and i'm trying to create a little website using ASP MVC2. I want to create my own authorization attribute. but i need to pass some values if this is possible. For example: [CustomAuthorize(GroupID = Method Parameter?] public ActionResult DoSomething(int GroupID) { return View(""); } I want to authorize the access to a page. but it depends on the value passed to the controller. So the authorization depends on the groupID. Is this possible to achieve this in any way?. Thanks in advance.

    Read the article

  • How to get a specific attribute from an object list?

    - by anarhikos
    I've an array keeping a list of Group objects. I want to set this list to the DropDownChoice component. However I want to show the end user only the name attribute of Group objects, and then get the selected values' id attribute to add database. What to do? private List<Group> groupTypes; DatabaseApp db = new DatabaseApp(); groupTypes = db.getGroups(); groupDropDownChoice = new DropDownChoice("type", groupTypes); ... ... addUserForm.add(new Button("submit"){ @Override public void onSubmit(){ Group group = (Group) groupDropDownChoice.getModelObject(); ... ... db.addUser(group.getId(), den, name, login, email, password1); DatabaseApp.java public List<Group> getGroups() throws SQLException{ List<Group> groups = new ArrayList<Group>(); try { String query = "SELECT * FROM [GROUP]"; Statement statement = db.createStatement(); ResultSet result = statement.executeQuery(query); while(result.next()){ int id = result.getInt("ID"); String name = result.getString("NAME"); groups.add(new Group(id, name)); } result.close(); } catch (SQLException ex) { throw new SQLException(ex.getMessage()); } return groups; }

    Read the article

  • NSPredicate (Core Data fetch) to filter on an attribute value being present in a supplied set (list)

    - by starbaseweb
    I'm trying to create a fetch predicate that is the analog to the SQL "IN" statement, and the syntax to do so with NSPredicate escapes me. Here's what I have so far (the relevant excerpt from my fetching routine): NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; NSEntityDescription *entity = [NSEntityDescription entityForName: @"BodyPartCategory" inManagedObjectContext:_context]; [request setEntity:entity]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(name IN %@)", [RPBodyPartCategory defaultBodyPartCategoryNames]]; [request setPredicate:predicate]; The entity "BodyPartCategory" has a string attribute "name". I have a list of names (just NSString objects) in an NSArray as returned by: [RPBodyPartCategory defaultBodyPartCategoryNames] So let's say that array has string such as {@"Liver", @"Kidney", @"Thyroid"} ... etc. I want to fetch all 'BodyPartCategory' instances whose name attribute matches one of the strings in the set provided (technically NSArray but I can make it an NSSet). In SQL, this would be something like: SELECT * FROM BodyPartCategories WHERE name IN ('Liver', 'Kidney', 'Thyroid') I've gone through various portions of the Predicate Programming Guide, but I don't see this simple use case covered. Pointers/help much appreciated!

    Read the article

  • LDAP object class violation: attribute ou not allowed in suffix?

    - by Paramaeleon
    I am about to set up a LDAP directory. It is used as a tool to communicate user permissions from a web application to WebDav file system access, e.g. adding a user to the web platform shall allow login to the file system with the same credentials. There are no other usages intended. Following this German tutorial which encourages the use of the attributes c, o, ou etc. over dc, I configured the following suffix and root: suffix "ou=webtool,o=myOrg,c=de" rootdn "cn=ldapadmin,ou=webtool,o=myOrg,c=de" Server starts and I can connect to it by LDAP Admin, which reports “LDAP error: Object lacks”. Well, there aren’t any objects yet. I now want to create the root and admin elements from shell. I created an init.ldif file: dn: ou=webtool,o=myOrg,c=de objectclass: dcObject objectclass: organization dc: webtool o: webtool dn: cn=ldapadmin,ou=webtool,o=myOrg,c=de objectclass: organizationalRole cn: ldapadmin Trying to load the file runs into an error, telling me that ou is not allowed: server:~ # ldapadd -x -D "cn=ldapadmin,ou=webtool,o=myOrg,c=de" -W -f init.ldif Enter LDAP Password: adding new entry "ou=webtool,o=myOrg,c=de" ldap_add: Object class violation (65) additional info: attribute 'ou' not allowed I am not using ou anywhere except in the suffix, so the question: Isn’t it allowed here? What is allowed here? Here is my answer. I am not allowed to post it as answer for 8 hours, so don’t mind that it is part of the question by now. I will move it outside some day, if I don’t forget to do so. There are numberous dependencies for the creation of elements, and error messages are rather confusing if you don’t know of the concept. The objectclass isn’t necessarily dcObject for the databases’ root node, as it is likely to guess when you read several tutoriales. Instead, it must correspond to the object’s type: Here, for a name starting with ou=, it must be organizationalUnit. I found this piece of information in these tables [Link removed due to restriction: Oops! Your edit couldn't be submitted because: We're sorry, but as a spam prevention mechanism, new users can only post a maximum of two hyperlinks. Earn more than 10 reputation to post more hyperlinks. Link is below]. Further on, the object class dictates which properties must and can be added in the record. Here, organizationalUnit must have an ou: entry and must not have neither dc: nor o: entry. The healthy init.ldif file looks like that: dn: ou=webtool,o=myOrg,c=de objectclass: organizationalUnit ou: LDAP server for my webtool dn: cn=ldapadmin,ou=webtool,o=myOrg,c=de objectclass: organizationalRole cn: ldapadmin Note: The page also states: “While many objectClasses show no MUST attributes you must (ouch) follow any hierarchy […] to determine if this is the really case.” I thought that would mean my root record would have to provide the must fields for c= and o= (c: and o:, respectively) but this isn’t the case. Link in answer is (1): http :// www (dot) zytrax (dot) com/books/ldap/ape/ "Appendix E: LDAP - Object Classes and Attributes"

    Read the article

  • Why is django giving me an attribute error when I call _set.all() for its children models?

    - by user1876508
    I have two models defined from django.db import models class Blog(models.Model): title = models.CharField(max_length=144) @property def posts(self): self.Post_set.all() class Post(models.Model): title = models.CharField(max_length=144) text = models.TextField() blog = models.ForeignKey('Blog') but the problem is, when I run shell, and enter >>> blog = Blog(title="My blog") >>> post = Post(title="My first post", text="Here is the main text for my blog post", blog=blog) >>> blog.posts I get the error Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/lucas/Programming/Python/Django/djangorestfun/blog/models.py", line 9, in posts self.Post_set.all() AttributeError: 'Blog' object has no attribute 'Post_set' >>> Now I am having the following problem >>> from blog.models import * >>> blog = Blog(title="gewrhter") >>> blog.save() >>> blog.__dict__ {'_state': <django.db.models.base.ModelState object at 0x259be10>, 'id': 1, 'title': 'gewrhter'} >>> blog._state.__dict__ {'adding': False, 'db': 'default'} >>> post = Post(title="sdhxcvb", text="hdbfdgb", blog=blog) >>> post.save() >>> post.__dict__ {'blog_id': 1, 'title': 'sdhxcvb', 'text': 'hdbfdgb', '_blog_cache': <Blog: Blog object>, '_state': <django.db.models.base.ModelState object at 0x259bed0>, 'id': 1} >>> blog.posts >>> print blog.posts None Second update So I followed your guide, but I am still getting nothing. In addition, blog.posts gives me an error. >>> from blog.models import * >>> blog = Blog(title="asdf") >>> blog.save() >>> post = Post(title="asdf", text="sdxcvb", blog=blog) >>> post.save() >>> blog.posts Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'Blog' object has no attribute 'posts' >>> print blog.all_posts None

    Read the article

  • How to add data from an NSTextField to a Core Data Attribute without having to press Return or Tab a

    - by roy-fleming
    I use a sheet with 3 NSTextFields and a Cancel- and OK-Button to edit the attributes of a Core Data Entity. The text entered in the NSTextFields is only updated in the Core Data Entity if i press Tab or Return after writing in the NSTextField or if i focus another NSTextField with the mouse. If i just enter text in an NSTextField and press the OK-Button the entered text is lost. Is there some attribute i can set in Interface Builder to change this NSTextField behaviour?

    Read the article

  • Is there an HTML attribute to tell smartphone keyboards to show special email keys?

    - by slolife
    I notice that when using my touch-screen smartphone (no physical keyboard) that when an app asks for an email address to be entered in a textbox, the on screen keyboard is modified slightly to provide specialized keys that enter blocks of text, like '.com' or push some characters to the foreground key, like '@'. Is there an HTML attribute or style that I can add to my HTML input boxes that will tell the smartphone/browser to provide these specialized keys?

    Read the article

  • What is the Dojo equivalent of jQuery's scope attribute?

    - by joolss
    Hi. I'm a Dojo n00b. In jQuery, a DOM node or jQuery object can be passed as an attribute in a query, which sets the scope: var myScope = $('#someDiv'); $('a',myScope).addClass('red'); $('li',myScope).css('display','inline'); Now, in Dojo I can chain several .query()s after each other, but what should I do if I have a certain DOM node - not a nodeList - that I want to use as a scope? KTHNX

    Read the article

  • Applying attribute to SVG using JS prompts 'this.textBox.style is undefined'. Why?

    - by Jack Roscoe
    Hi, I'm using the following code to draw an SVG text box, and then change its text anchor attribute to 'left' as it defaults to center and that's nasty. The text generates correctly, but when I add this second line I get the error 'this.textBox.style is undefined' in my error console. Here's my code: RenderTextBox:function() { // Render Text this.textBox = paper.text(this.x, this.y, this.htmlText); this.textBox.style.textAnchor="left"; } Any ideas?

    Read the article

  • Magento user created attribute for products is not saved...

    - by Elzo Valugi
    I am fighting an apparently simple thing for about two days now. I hope somebody can help. I created the myUpdate EAV attribute class Company_Module_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup { public function getDefaultEntities() { return array( 'catalog_product' => array( 'entity_model' => 'catalog/product', 'attribute_model' => 'catalog/resource_eav_attribute', 'table' => 'catalog/product', 'additional_attribute_table' => 'catalog/eav_attribute', 'entity_attribute_collection' => 'catalog/product_attribute_collection', 'attributes' => array( 'my_update' => array( 'label' => 'My timestamp', 'type' => 'datetime', 'input' => 'date', 'default' => '', 'class' => 'validate-date', 'backend' => 'eav/entity_attribute_backend_datetime', 'frontend' => '', 'table' => '', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible' => true, 'required' => false, 'user_defined' => true, 'searchable' => false, 'filterable' => false, 'comparable' => false, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false, 'apply_to' => 'simple', ) ) ) ); } } The attribute is created OK and on install appears correctly in the list of attributes. Later I do // for product 1 $product->setMyUpdate($stringDate); // string this format: yyyy-MM-dd HH:mm:ss $product->save(); // and saves without issues * in admin module But later when I do: $product = Mage::getModel('catalog/product')->load(1); var_dump($product->getMyUpdate()); // returns null Somehow the data is not really saved.. or I am not retrieving it correctly. Please advice on how to get the data and where the data is saved in the DB so I can check at if the insert is done correctly. Thanks.

    Read the article

  • How to select the IMG tag based on the attribute?

    - by Tejas
    <IMG height="160" alt="Web Content Image" src="../image/journal/article?img_id=16505&t=1273484793531" width="240" pngSet /> I have the this code for the image , and I want to select the image based on the attribute "pngSet" I am trying this , but not working. $("img[pngSet='']").css('border' ,'1px solid red');

    Read the article

  • ahow can I resolve Django Error: str' object has no attribute 'autoescape'?

    - by Angelbit
    Hi have tried to create a inclusion tag on Django but don't work and return str' object has no attribute 'autoescape' this is the code of custom tag: from django import template from quotes.models import Quotes register = template.Library() def show_quote(): quote = Quotes.objects.values('quote', 'author').get(id=0) return {'quote': quote['quote']} register.inclusion_tag('quotes.html')(show_quote) EDIT: Quote class from django.db import models class Quotes(models.Model): quote = models.CharField(max_length=255) author = models.CharField(max_length=100) class Meta: db_table = 'quotes' quotes.html <blockquote id="quotes">{{ quote }}</blockquote>

    Read the article

  • Can't get the value of an attribute with Selenium RC using xpath??

    - by Gj
    I'm trying to get the first href attribute in a page using Selenium RC (in Python): sel.get_text("xpath=//@href") this returns an empty string. However, an identical xpath on the same page inside Firefox (using the "View XPath" extension) yields the correct value. I've tried fiddling with it, but the same happens for other attributes (eg @class) -- is there something awfully wrong with selenium or am I overlooking something trivial here?

    Read the article

  • How can I retrieve the instance of an attribute's associated object?

    - by Brandon Linton
    I'm writing a PropertiesMustMatch validation attribute that can take a string property name as a parameter. I'd like it to find the corresponding property by name on that object and do a basic equality comparison. What's the best way to access this through reflection? Also, I checked out the Validation application block in the Enterprise Library and decided its PropertyComparisonValidator was way too intense for what we need.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >