Search Results

Search found 11632 results on 466 pages for 'field'.

Page 22/466 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • SQL inner join from field defined table?

    - by Wolftousen
    I have a, currently, a total of 6 tables that are part of this question. The primary table, tableA, contains columns that all the entries in the other 5 tables have in common. The other 5 tables have columns which define the entry in tableA in more detail. For example: TableA ID|Name|Volumn|Weight|Description 0 |T1 |0.4 |0.1 |Random text 1 |R1 |5.3 |25 |Random text TableB ID|Color|Shape 0 |Blue |Sphere TableC ID|Direction|Velocity 1 |North |3.4 (column names are just examples don't take them for what they mean...) The ID field in Table A is unique to all other tables (i.e. TableB will have 0, but TableC will not, nor any other Tables). What I would like to do is select all the fields from TableA and the corresponding (according to ID field) detail Table (TableB-F). What I have currently done and not tested is added a field to TableA so it looks like this: TableA ID|Name|Volumn|Weight|Description|Table 0 |T1 |0.4 |0.1 |Random text|TableB 1 |R1 |5.3 |25 |Random text|TableC I have a few questions about this: 1.Is it proper to do such a thing to TableA, as foreign keys wont work in this situation since they all need to link to different tables? 2.If this is proper, would the SQL query look like this (ID would be input by the user)? SELECT * FROM TableA AS a INNER JOIN a.Table AS t ON a.ID = ID; 3.Is there a better way to do this? Thanks for the help.

    Read the article

  • Drupal 7: How can I create a key/value field(or field group, if that's even possible)?

    - by Su'
    Let's say I'm creating some app documentation. In creating a content type for functions, I have a text field for name, a box for a general description, and a couple other basic things. Now I need something for storing arguments to the function. Ideally, I'd like to input these as key-value pairs, or just two related fields, which can then be repeated as many times as needed for the given function. But I can't find any way to accomplish this. The closest I've gotten is an abandonded field multigroup module that says to wait for CCK3, which hasn't even produced an alpha yet as far as I can tell and whose project page makes no obvious mention of this multi-group functionality. I also checked the CCK issue queue and don't think I saw it in there, either. Is there a current viable way of doing this I'm not seeing? Viable includes "you're thinking of this the wrong way and do X instead." I've considered using a "Long text and summary" field, but that smells hackish and I don't know if I'd be setting myself up for side-effects. I'm new to Drupal.

    Read the article

  • Data Type Not Consistent In MS Access? (Set new field as "TEXT" but system treats it as "Yes/No" field)

    - by user3522506
    I already have an SQL command that will insert any string in the field. But it doesn't accept any string, giving me "No value given for one or more required parameters". But if my string is "Yes" or "No", it will update successfully. And in MS Access, will appear as 0 or -1 even though I set the field as text even in the beginning. Could there be any configuration I have made in my MS Access 2007? con = New OleDbConnection(cs) con.Open() Dim cb As String = "Update FS_Expenses set FS_Date=#" & dtpDate2.Text & "#,SupplierID='" & txtSupplierID.Text & "', TestField=" & Label1.Text & " where ID=" & txtID2.Text & "" cmd = New OleDbCommand(cb) cmd.Connection = con cmd.ExecuteReader() MessageBox.Show("Successfully updated!", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information) con.Close() TestField is already a TEXT data type, Label1.Text value is "StringTest", will give the error. However, set Label1.Text value as = "Yes", SQL will execute successfully. Therefore, field must have not been saved as TEXT.

    Read the article

  • Question about a http form GET method, using query arguments

    - by Lasse V. Karlsen
    I am looking at a bug in WebSVN where when I get into a file log and click on compare, it looses the repository name as part of the request. The details are unimportant. However, I've tracked down the bug to a http form that looks like this: <form method="get" action="comp.php?repname=Binaries&amp;" id="compare"> .... <input type="hidden" name="KEY" value="VALUE"> Is this supposed to work? Will both the "repname" argument, specified as part of the URL, and the hidden value be sent? It seems Chrome 4.1 only sends the hidden argument, and removes the repname parameter altogether. Is this correct? I fixed it temporarily, pending more information, by adding another hidden field for repname with the same value, and now everything works, I'm just wondering if Chrome or WebSVN is in fault here.

    Read the article

  • xcode UIWebView - Text Fields = No on screen keyboard.

    - by Aakburns
    This application is used to let you use our company basecamp site and only that site. When logged in, if you go to post a new message, you can insert text in the title text field, but if you try to tap in the message body section, it does not bring up the keyboard. I have to assume it's something with my coding, because safari works just fine with it. You can pick textile/html mode or easy. The keyboard does come up in textile/html mode but not in easy formatting mode. Any ideas? Here are some screenshot examples from the iPad. This is shown as the text view not working, no keyboard comes up when you tap in the box. arikburnsDOTcom/forums/fn/IMG_0007.png If you click on 'Switch to Textile/HTML' As seen in the image above, you are presented with this new text box which you can tap in and the keyboard comes up. arikburnsDOTcom/forums/fn/IMG_0006.PNG Now, also note, if you load this same page up in safari, it doesn't actually give you an option as to what text formatting to use, it just works. No options. I basically need to force the 'Textile/HTML' text box somehow and no I cannot change the website code itself. Thanks in advance.

    Read the article

  • DataGrid finding a control

    - by nat
    HI I have a DataGrid (yes would be nicer if it was a gridview but nothing i can do about that) in the itemDataBound event i am adding a hidden field into the first cell of each row I am setting its ID based on something, and then saving its clientID in a List for later attempts to get the value from it but try as i might i cant find anything with findcontrol have tried here is the itemdatabound bit foreach(page in datasource){ HiddenField hidOrder = new HiddenField(); hidOrder.ID = "order_" + page.Id.ToString(); hidOrder.Value = page.Ordering.ToString(); e.Item.Cells[0].Controls.Add(hidOrder); idList.Add(hidOrder.ClientID); } then this is a button click event.. int numRows = FrontEndDataGrid.Items.Count; for (int i = 0; i < numRows; i++){ foreach(string hidID in idList){ HiddenField hf = FrontEndDataGrid.Items[i].FindControl(hidID) as HiddenField; //ssadly this never finds anything //have also tried looping around the cells for each 'row' - no luck there either } } any ideas? thanks nat

    Read the article

  • jQuery: preventDefault() not working on input/click events?

    - by Jason
    I want to disable the default contextMenu when a user right-clicks on an input field so that I can show a custom contextMenu. Generally speaking, its pretty easy to disable the right-click menu by doing something like: $([whatever]).bind("click", function(e) { e.preventDefault(); }); And in fact, I can do this on just about every element EXCEPT for input fields in FF - anyone know why or could point me towards some documentation? Here is the relevant code I am working with, thanks guys. HTML: <script type="text/javascript"> var r = new RightClickTool(); </script> <div id="main"> <input type="text" class="listen rightClick" value="0" /> </div> JS: function RightClickTool(){ var _this = this; var _items = ".rightClick"; $(document).ready(function() { _this.init(); }); this.init = function() { _this.setListeners(); } this.setListeners = function() { $(_items).click(function(e) { var webKit = !$.browser.msie && e.button == 0; var ie = $.browser.msie && e.button == 1; if(webKit||ie) { // Left mouse...do something() } else if(e.button == 2) { e.preventDefault(); // Right mouse...do something else(); } }); } } // Ends Class

    Read the article

  • Using javascript to add form fields, but what will the new name be?

    - by user1322844
    After reading this post: using javascript to add form fields.. but below, not to the side? I've made the button work! But I don't know how to receive the output. This is what I entered. var counter = 0; function addNew() { // Get the main Div in which all the other divs will be added var mainContainer = document.getElementById('mainContainer'); // Create a new div for holding text and button input elements var newDiv = document.createElement('div'); // Create a new text input var newText = document.createElement('input'); newText.type = "input"; newText.maxlength = "50"; newText.maxlimit = "50"; newText.size = "60"; newText.value = counter; // Create a new button input var newDelButton = document.createElement('input'); newDelButton.type = "button"; newDelButton.value = "Delete"; // Append new text input to the newDiv newDiv.appendChild(newText); // Append new button input to the newDiv newDiv.appendChild(newDelButton); // Append newDiv input to the mainContainer div mainContainer.appendChild(newDiv); counter++; // Add a handler to button for deleting the newDiv from the mainContainer newDelButton.onclick = function() { mainContainer.removeChild(newDiv); } } </script> With this in the form: <input type="button" size="3" cols="30" value="Add" onClick="addNew()"> So, what will the new field names be? I don't understand enough of the coding to figure out what I'm telling it to. Good thing there are other smart folks out there for me to lean on! Thanks for any answers.

    Read the article

  • Drupal 6: getting particular fields from Node Reference types...

    - by artmania
    Hi friends, I'm a drupal newbie... <?php print $node->field_date[0]['view']; ?> I can get the custom created CCK fields' value and display in tpl.php files as above... that's fine. my question is how can I get the Node reference fields' in-fields? for example, I have an event content type, and I have defined Node Reference for Location (title, address, img, etc.). When I write the code below, it displays all location content; <?php print $node->field_location[0]['view']; ?> but I need to get only address field from this location content type. sth like below would be great :D but not working; <?php print $node->field_location[0]['field_address']['view']; ?> so how can get that? appreciate helps so much! thanks a lot!

    Read the article

  • How do I access static variables in an enum class without a class instance?

    - by krick
    I have some code that processes fixed length data records. I've defined the record structures using java enums. I've boiled it down the the simplest example possible to illustrate the hoops that I currently have to jump through to get access to a static variable inside the enum. Is there a better way to get at this variable that I'm overlooking? If you compile and run the code, it just prints out "3". Note: the "code" tag doesn't seem to want to format this properly, but it should compile. class EnumTest { private interface RecordLayout { public int length(); } private enum RecordType1 implements RecordLayout { FIELD1 (2), FIELD2 (1), ; private int length; private RecordType1(int length) { this.length = length; } public int length() { return length; } public static int LEN = 3; } private static <E extends Enum<E> & RecordLayout> String parse(String data, Class<E> record) { // ugly hack to get at LEN... try { int len = record.getField("LEN").getInt(record); System.out.println(len); } catch (Exception e) { System.out.println(e); } String results = ""; for (E field: record.getEnumConstants()) { // do some stuff with the fields } return results; } public static void main(String args[]) { parse("ABC", RecordType1.class); } }

    Read the article

  • Using SPServices &amp; jQuery to Find My Stuff from Multi-Select Person/Group Field

    - by Mark Rackley
    Okay… quick blog post for all you SPServices fans out there. I needed to quickly write a script that would return all the tasks currently assigned to me.  I also wanted it to return any task that was assigned to a group I belong to. This can actually be done with a CAML query, so no big deal, right?  The rub is that the “assigned to” field is a multi-select person or group field. As far as I know (and I actually know so little) you cannot just write a CAML query to return this information. If you can, please leave a comment below and disregard the rest of this blog post… So… what’s a hacker to do? As always, I break things down to their most simple components (I really love the KISS principle and would get it tattooed on my back if people wouldn’t think it meant “Knights In Satan’s Service”. You really gotta be an old far to get that reference).  Here’s what we’re going to do: Get currently logged in user’s name as it is stored in a person field Find all the SharePoint groups the current user belongs to Retrieve a set of assigned tasks from the task list and then find those that are assigned to current  user or group current user belongs to Nothing too hairy… So let’s get started Some Caveats before I continue There are some obvious performance implications with this solution as I make a total of four SPServices calls and there’s a lot of looping going on. Also, the CAML query in this blog has NOT been optimized. If you move forward with this code, tweak it so that it returns a further subset of data or you will see horrible performance if you have a few hundred entries in your task list. Add a date range to the CAML or something. Find some way to limit the results as much as possible. Lastly, if you DO have a better solution, I would like you to share. Iron sharpens iron and all…   Alright, let’s really get started. Get currently logged in user’s name as it is stored in a person field First thing we need to do is understand how a person group looks when you look at the XML returned from a SharePoint Web Service call. It turns out it’s stored like any other multi select item in SharePoint which is <id>;#<value> and when you assign a person to that field the <value> equals the person’s name “Mark Rackley” in my case. This is for Windows Authentication, I would expect this to be different in FBA, but I’m not using FBA. If you want to know what it looks like with FBA you can use the code in this blog and strategically place an alert to see the value.  Anyway… I need to find the name of the user who is currently logged in as it is stored in the person field. This turns out to be one SPServices call: var userName = $().SPServices.SPGetCurrentUser({                     fieldName: "Title",                     debug: false                     }); As you can see, the “Title” field has the information we need. I suspect (although again, I haven’t tried) that the Title field also contains the user’s name as we need it if I was using FBA. Okay… last thing we need to do is store our users name in an array for processing later: myGroups = new Array(); myGroups.push(userName); Find all the SharePoint groups the current user belongs to Now for the groups. How are groups returned in that XML stream?  Same as the person <ID>;#<Group Name>, and if it’s a mutli select it’s all returned in one big long string “<ID>;#<Group Name>;#<ID>;#<Group Name>;#<ID>;#<Group Name>;#<ID>;#<Group Name>;#<ID>;#<Group Name>”.  So, how do we find all the groups the current user belongs to? This is also a simple SPServices call. Using the “GetGroupCollectionFromUser” operation we can find all the groups a user belongs to. So, let’s execute this method and store all our groups. $().SPServices({       operation: "GetGroupCollectionFromUser",       userLoginName: $().SPServices.SPGetCurrentUser(),       async: false,       completefunc: function(xData, Status) {          $(xData.responseXML).find("[nodeName=Group]").each(function() {                 myGroups.push($(this).attr("Name"));          });         }     }); So, all we did in the above code was execute the “GetGroupCollectionFromUser” operation and look for the each “Group” node (row) and store the name for each group in our array that we put the user’s name in previously (myGroups). Now we have an array that contains the current user’s name as it will appear in the person field XML and  all the groups the current user belongs to. The Rest Now comes the easy part for all of you familiar with SPServices. We are going to retrieve our tasks from the Task list using “GetListItems” and look at each entry to see if it belongs to this person. If it does belong to this person we are going to store it for later processing. That code looks something like this: // get list of assigned tasks that aren't closed... *modify the CAML to perform better!*             $().SPServices({                   operation: "GetListItems",                   async: false,                   listName: "Tasks",                   CAMLViewFields: "<ViewFields>" +                             "<FieldRef Name='AssignedTo' />" +                             "<FieldRef Name='Title' />" +                             "<FieldRef Name='StartDate' />" +                             "<FieldRef Name='EndDate' />" +                             "<FieldRef Name='Status' />" +                             "</ViewFields>",                   CAMLQuery: "<Query><Where><And><IsNotNull><FieldRef Name='AssignedTo'/></IsNotNull><Neq><FieldRef Name='Status'/><Value Type='Text'>Completed</Value></Neq></And></Where></Query>",                     completefunc: function (xData, Status) {                         var aDataSet = new Array();                        //loop through each returned Task                         $(xData.responseXML).find("[nodeName=z:row]").each(function() {                             //store the multi-select string of who task is assigned to                             var assignedToString = $(this).attr("ows_AssignedTo");                             found = false;                            //loop through the persons name and all the groups they belong to                             for(var i=0; i<myGroups.length; i++) {                                 //if the person's name or group exists in the assigned To string                                 //then the task is assigned to them                                 if (assignedToString.indexOf(myGroups[i]) >= 0){                                     found = true;                                     break;                                 }                             }                             //if the Task belongs to this person then store or display it                             //(I'm storing it in an array)                             if (found){                                 var thisName = $(this).attr("ows_Title");                                 var thisStartDate = $(this).attr("ows_StartDate");                                 var thisEndDate = $(this).attr("ows_EndDate");                                 var thisStatus = $(this).attr("ows_Status");                                                                  var aDataRow=new Array(                                     thisName,                                     thisStartDate,                                     thisEndDate,                                     thisStatus);                                 aDataSet.push(aDataRow);                             }                          });                          SomeFunctionToDisplayData(aDataSet);                     }                 }); Some notes on why I did certain things and additional caveats. You will notice in my code that I’m doing an AssignedToString.indexOf(GroupName) to see if the task belongs to the person. This could possibly return bad results if you have SharePoint Group names that are named in such a way that the “IndexOf” returns a false positive.  For example if you have a Group called “My Users” and a group called “My Users – SuperUsers” then if a user belonged to “My Users” it would return a false positive on executing “My Users – SuperUsers”.IndexOf(“My Users”). Make sense? Just be aware of this when naming groups, we don’t have this problem. This is where also some fine-tuning can probably be done by those smarter than me. This is a pretty inefficient method to determine if a task belongs to a user, I mean what if a user belongs to 20 groups? That’s a LOT of looping.  See all the opportunities I give you guys to do something fun?? Also, why am I storing my values in an array instead of just writing them out to a Div? Well.. I want to pass my data to a jQuery library to format it all nice and pretty and an Array is a great way to do that. When all is said and done and we put all the code together it looks like:   $(document).ready(function() {         var userName = $().SPServices.SPGetCurrentUser({                     fieldName: "Title",                     debug: false                     });         myGroups = new Array();     myGroups.push(userName );       $().SPServices({       operation: "GetGroupCollectionFromUser",       userLoginName: $().SPServices.SPGetCurrentUser(),       async: false,       completefunc: function(xData, Status) {          $(xData.responseXML).find("[nodeName=Group]").each(function() {                 myGroups.push($(this).attr("Name"));          });                      // get list of assigned tasks that aren't closed... *modify this CAML to perform better!*             $().SPServices({                   operation: "GetListItems",                   async: false,                   listName: "Tasks",                   CAMLViewFields: "<ViewFields>" +                             "<FieldRef Name='AssignedTo' />" +                             "<FieldRef Name='Title' />" +                             "<FieldRef Name='StartDate' />" +                             "<FieldRef Name='EndDate' />" +                             "<FieldRef Name='Status' />" +                             "</ViewFields>",                   CAMLQuery: "<Query><Where><And><IsNotNull><FieldRef Name='AssignedTo'/></IsNotNull><Neq><FieldRef Name='Status'/><Value Type='Text'>Completed</Value></Neq></And></Where></Query>",                     completefunc: function (xData, Status) {                         var aDataSet = new Array();                         //loop through each returned Task                         $(xData.responseXML).find("[nodeName=z:row]").each(function() {                             //store the multi-select string of who task is assigned to                             var assignedToString = $(this).attr("ows_AssignedTo");                             found = false;                            //loop through the persons name and all the groups they belong to                             for(var i=0; i<myGroups.length; i++) {                                 //if the person's name or group exists in the assigned To string                                 //then the task is assigned to them                                 if (assignedToString.indexOf(myGroups[i]) >= 0){                                     found = true;                                     break;                                 }                             }                            //if the Task belongs to this person then store or display it                             //(I'm storing it in an array)                             if (found){                                 var thisName = $(this).attr("ows_Title");                                 var thisStartDate = $(this).attr("ows_StartDate");                                 var thisEndDate = $(this).attr("ows_EndDate");                                 var thisStatus = $(this).attr("ows_Status");                                                                  var aDataRow=new Array(                                     thisName,                                     thisStartDate,                                     thisEndDate,                                     thisStatus);                                 aDataSet.push(aDataRow);                             }                          });                          SomeFunctionToDisplayData(aDataSet);                     }                 });       }    });  }); Final Thoughts So, there you have it. Take it and run with it. Make it something cool (and tell me how you did it). Another possible way to improve performance in this scenario is to use a DVWP to display the tasks and use jQuery and the “myGroups” array from this blog post to hide all those rows that don’t belong to the current user. I haven’t tried it, but it does move some of the processing off to the server (generating the view) so it may perform better.  As always, thanks for stopping by… hope you have a Merry Christmas…

    Read the article

  • ASPNET MVC - Why is ModelState.IsValid false "The x field is required" when that field does have a v

    - by JK
    I have a model like this: public PurchaseOrder { [Required] [StringLength(15)] public virtual string OrderNumber {get;set;} // etc. } When I submit an order from the view (using $.post, not input type=submit) it goes to my controller class: public class PurchaseOrderController { public JsonResult Save(PurchaseOrder order) { // TryUpdateModel(order); // commented out since modelstate.isvalid remains false anyway if (ModelState.IsValid) { // its never valid } } } ModelState.IsValid always returns false, with the error: "The Order Number field is required." But there is a value in this field (?? why) Why would it say "value is required" when it does have a value? Have I missed something? Is it because of the $.post instead of the submit? What can I do? This is what the debugger looks like:

    Read the article

  • WMI Win32_OperatingSystem OSArchitecture field causes exception

    - by Andrew J. Brehm
    I am trying to get information on the version of Windows installed from WMI. Most fields work. I can get the operating system "Name" as well as the "Version", both are fields of the Win32_OperatingSystem object I have. But another field "OSArchitecture" generates an exception ("Not found"). strScope = "\\" + strServer + "\root\CIMV2" searcher = New ManagementObjectSearcher(strScope, "SELECT * FROM Win32_OperatingSystem") For Each mo In searcher.Get strOSName = mo("Name") strOSVersion = mo("Version") strOSArchitecture = mo("Architecture") strStatus = mo("Status") strLastBoot = mo("LastBootUpTime") Next The documentation says that the field ought to exist and is a String: http://msdn.microsoft.com/en-us/library/aa394239(VS.85).aspx Any ideas?

    Read the article

  • jquery - check length of input field?

    - by KnockKnockWhosThere
    The code below is intended to enable the submit button once the user clicks in the textarea field. It works, but I'm trying to also make it so that it's only enabled if there's at least one character in the field. I tried wrapping it in: if($(this).val().length > 1) { } But, that didn't seem to work... Any ideas? $("#fbss").focus(function(){ $(this).select(); if($(this).val()=="Default text") { $(this).val(""); $("input[id=fbss-submit]").removeClass(); $("input[id=fbss-submit]").attr('disabled',false); $("input[id= fbss-submit]").attr('class','.enableSubmit'); if($('.charsRemaining')) { $('.charsRemaining').remove(); $("textarea[id=fbss]").maxlength({ maxCharacters: 190, status: true, statusClass: 'charsRemaining', statusText: 'characters left', notificationClass: 'notification', showAlert: false, alertText: 'You have exceeded the maximum amount of characters', slider: false }); } });

    Read the article

  • VisualForce: convert carriage returns to html line-breaks in a long text field

    - by codeulike
    In Salesforce, if I'm binding a text field into a VisualForce page, whats a good way to convert the carriage returns in the text-field into HTML <br/> tags? e.g. starting from something like this: <apex:page standardController="Case"> <apex:pageBlock title="Test"> <p>{!case.Description}</p> </apex:pageBlock> <apex:detail relatedList="false" /> </apex:page> ... if the Description is very long with lots of carriage returns, how do I HTML-ify it? (I guess this is a fairly easy question, and I'm sure I could google it, but to get the Salesforce community going on here I figure we need a few easy questions.)

    Read the article

  • System.Uri can't parse when password field contains a "#"

    - by Andrew
    The following code throws System.UriFormatException: var uri = new UriBuilder("ftp://user:pass#[email protected]:21/fu/bar.zip"); System.UriFormatException: Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed. Removing the # symbol from the password field solves the issue. Is a # symbol a valid character to have in the password field? Is there a way to escape this? Is this a known bug in the parsing routine of the Uri class? How does one get around this - assuming you can't change the password? ;-) Thanks, Andrew

    Read the article

  • How to read a Choice Field from Sharepoint 2010 Client Object Model

    - by Eric
    Hello, I'm using Sharepoint 2010 Object Model. I'm trying to retrive the content of a Custom List. Everything works fine except if when I try to retrieve a Choice Field. When I try to retrieve the choice field, I got an PropertyOrFieldNotInitializedException exception... Here is the code I'm using: ClientContext clientContext = new ClientContext("https://mysite"); clientContext.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("aaa", bbb"); clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; List list = clientContext.Web.Lists.GetByTitle("mylist"); CamlQuery camlQuery = new CamlQuery(); camlQuery.ViewXml = "<View/>"; ListItemCollection listItems = list.GetItems(camlQuery); clientContext.Load(listItems); clientContext.ExecuteQuery(); foreach (ListItem listItem in listItems) { listBoxControl1.Items.Add(listItem["Assigned_x0020_Company"]); } Thank you for you help! Eric

    Read the article

  • jquery dynamic form plugin: adding nested field support

    - by goliatone
    Hi, Im using the jQuery dynamic form plugin, but i need support for nested field duplication. I would like some advice on how to modify the plugin to add such functionality. Im not a javascript/jQuery developer, so any advice on which route to take will be much appreciated. I can provide the plugin's code: /** * @author Stephane Roucheray * @extends jQuery */ jQuery.fn.dynamicForm = function (plusElmnt, minusElmnt, options){ var source = jQuery(this), minus = jQuery(minusElmnt), plus = jQuery(plusElmnt), template = source.clone(true), fieldId = 0, formFields = "input, checkbox, select, textarea", insertBefore = source.next(), clones = [], defaults = { duration:1000 }; // Extend default options with those provided options = $.extend(defaults, options); isPlusDescendentOfTemplate = source.find("*").filter(function(){ return this == plus.get(0); }); isPlusDescendentOfTemplate = isPlusDescendentOfTemplate.length > 0 ? true : false; function normalizeElmnt(elmnt){ elmnt.find(formFields).each(function(){ var nameAttr = jQuery(this).attr("name"), idAttr = jQuery(this).attr("id"); /* Normalize field name attributes */ if (!nameAttr) { jQuery(this).attr("name", "field" + fieldId + "[]"); } if (!/\[\]$/.exec(nameAttr)) { jQuery(this).attr("name", nameAttr + "[]"); } /* Normalize field id attributes */ if (idAttr) { /* Normalize attached label */ jQuery("label[for='"+idAttr+"']").each(function(){ jQuery(this).attr("for", idAttr + fieldId); }); jQuery(this).attr("id", idAttr + fieldId); } fieldId++; }); }; /* Hide minus element */ minus.hide(); /* If plus element is within the template */ if (isPlusDescendentOfTemplate) { function clickOnPlus(event){ var clone, currentClone = clones[clones.length -1] || source; event.preventDefault(); /* On first add, normalize source */ if (clones.length == 0) { normalizeElmnt(source); currentClone.find(minusElmnt).hide(); currentClone.find(plusElmnt).hide(); }else{ currentClone.find(plusElmnt).hide(); } /* Clone template and normalize it */ clone = template.clone(true).insertAfter(clones[clones.length - 1] || source); normalizeElmnt(clone); /* Normalize template id attribute */ if (clone.attr("id")) { clone.attr("id", clone.attr("id") + clones.length); } plus = clone.find(plusElmnt); minus = clone.find(minusElmnt); minus.get(0).removableClone = clone; minus.click(clickOnMinus); plus.click(clickOnPlus); if (options.limit && (options.limit - 2) > clones.length) { plus.show(); }else{ plus.hide(); } clones.push(clone); } function clickOnMinus(event){ event.preventDefault(); if (this.removableClone.effect && options.removeColor) { that = this; this.removableClone.effect("highlight", { color: options.removeColor }, options.duration, function(){that.removableClone.remove();}); } else { this.removableClone.remove(); } clones.splice(clones.indexOf(this.removableClone),1); if (clones.length == 0){ source.find(plusElmnt).show(); }else{ clones[clones.length -1].find(plusElmnt).show(); } } /* Handle click on plus */ plus.click(clickOnPlus); /* Handle click on minus */ minus.click(function(event){ }); }else{ /* If plus element is out of the template */ /* Handle click on plus */ plus.click(function(event){ var clone; event.preventDefault(); /* On first add, normalize source */ if (clones.length == 0) { normalizeElmnt(source); jQuery(minusElmnt).show(); } /* Clone template and normalize it */ clone = template.clone(true).insertAfter(clones[clones.length - 1] || source); if (clone.effect && options.createColor) { clone.effect("highlight", {color:options.createColor}, options.duration); } normalizeElmnt(clone); /* Normalize template id attribute */ if (clone.attr("id")) { clone.attr("id", clone.attr("id") + clones.length); } if (options.limit && (options.limit - 3) < clones.length) { plus.hide(); } clones.push(clone); }); /* Handle click on minus */ minus.click(function(event){ event.preventDefault(); var clone = clones.pop(); if (clones.length >= 0) { if (clone.effect && options.removeColor) { that = this; clone.effect("highlight", { color: options.removeColor, mode:"hide" }, options.duration, function(){clone.remove();}); } else { clone.remove(); } } if (clones.length == 0) { jQuery(minusElmnt).hide(); } plus.show(); }); } };

    Read the article

  • An Object reference is required for the non-static field

    - by Muhammad Akhtar
    I have make my existing method to static method to get access in javascript, like.. [WebMethod(EnableSession = true), ScriptMethod()] public static void Build(String ID) { Control releaseControl = LoadControl("~/Controls/MyControl.ascx"); //An Object reference is required for the non-static field, mthod or property // 'System.Web.UI.TemplateControl.LoadControl(string)' plc.Controls.Add(releaseControl); // where plc is place holder control //object reference is required for the nonstatic field, method, or property '_Default.pl' } When I build I am getting error and I have posted these in comments below each line before converted it to static method, it working perfectly. Please suggest me the solution of my issue. Thanks

    Read the article

  • Django Formset validation with an optional ForeignKey field

    - by Camilo Díaz
    Having a ModelFormSet built with modelformset_factory and using a model with an optional ForeignKey, how can I make empty (null) associations to validate on that form? Here is a sample code: ### model class Prueba(models.Model): cliente = models.ForeignKey(Cliente, null = True) valor = models.CharField(max_length = 20) ### view def test(request): PruebaFormSet = modelformset_factory(model = Prueba, extra = 1) if request.method == 'GET': formset = PruebaFormSet() return render_to_response('tpls/test.html', {'formset' : formset}, context_instance = RequestContext(request)) else: formset = PruebaFormSet(request.POST) # dumb tests, just to know if validating if formset.is_valid(): return HttpResponse('0') else: return HttpResponse('1') In my template, i'm just calling the {{ form.cliente }} method which renders the combo field, however, I want to be able to choose an empty (labeled "------") value, as the FK is optional... but when the form gets submitted it doesn't validate. Is this normal behaviour? How can i make this field to skip required validation?

    Read the article

  • How do I get fluent nhibernate to create a varbinary(max) field in sql server

    - by czk
    Hi, How can I get fluent nhibernate to create a varbinary field in a sql server 2005 table that uses a field size of varbinary(max)? At the moment I always get a default of varbinary(8000), which isn't big enough as i'm going to be storing image files. I've tried using CAstle.ActiveRecord but havent had any success yet. [ActiveRecord] public class MyFile : Entity { public virtual string FileName { get; set; } public virtual string FileType { get; set; } public virtual int FileVersion { get; set; } public virtual int FileLength { get; set; } [Property(ColumnType = "BinaryBlob", SqlType = "VARBINARY(MAX)")] public virtual byte[] FileData { get; set; } } Been failing at finding a solution for hours now, so thanks in advance czk

    Read the article

  • Default value for field in Django model

    - by Daniel Garcia
    Suppose I have a model: class SomeModel(models.Model): id = models.AutoField(primary_key=True) a = models.IntegerField(max_length=10) b = models.CharField(max_length=7) Currently I am using the default admin to create/edit objects of this type. How do I set the field 'a' to have the same number as id? (default=???) Other question Suppose I have a model: event_date = models.DateTimeField( null=True) year = models.IntegerField( null=True) month = models.CharField(max_length=50, null=True) day = models.IntegerField( null=True) How can i set the year, month and day fields by default to be the same as event_date field?

    Read the article

  • lucene.net get starting and end index of a highlighted fragment in a searched field

    - by user339995
    "My search returns a highlighted fragment from a field. I want to know that in that field of particular searched document, where does that fragment starts and ends ?" for instance. consider i am searching "highlighted fragment" in above lines (consider the above para as single document). I am setting my fragmenter as : SimpleFragmenter fragmenter = new SimpleFragmenter(30); now the output of GetBestFragment is somewhat like : "returns a highlighted fragment from" Is it possible to get the starting and ending index of this fragment in the text above (say starting is 10 and ending is 45)

    Read the article

  • Unable to understand "A field initializer cannot reference the nonstatic field" Error?

    - by Subhen
    Hi, I am getting the error "A field initializer cannot reference the nonstatic field", While My code is as below: Object selectedItem = PageVariables.slectedItemData; MyClass selectedItems = (MyClass)selectedItem; But the same thing works if assign the value at the constructor or in a different method , like below: public partial class MusicPlayer : Page { Object selectedItem = PageVariables.slectedItemData; public MusicPlayer() { InitializeComponent(); MyClass selectedItems = (MyClass)selectedItem; } } I am just trying to understand what is the difference, Why it is looking for a static varaible declaration(in 1st case) while doesn't look for it while in a constructor or a different method!!!

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >