Search Results

Search found 11927 results on 478 pages for 'pete field'.

Page 13/478 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • search through related field for specific related object

    - by dotty
    Hay, I'm working on a simple voting system, where users can vote on a poll. My model looks like this class Poll(models.Model): question = models.CharField() votes = models.IntegerField() usersVoted = models.ManyToManyField(User) Now, i want to scan through the usersVoted field to see if a User object is in there. This User object will then be matched against a logged in User (User obj saved in a session). If the User has voted i want to be able to set a 'has_voted' field. I then want to use this field in my view. I will be using the Property() thingy inside the model to work this 'has_voted' value out. Like so def _can_vote(self): return False can_vote = property(_can_vote) Obviously it'll return a Bool. Any ideas how to search through a related field to find a specific Object?

    Read the article

  • How can I set a field to null in a Pre-Update Plugin

    - by Juergen
    I developed a Pre-Update Plugin for the Case entity. In this plugin I want to set a string field to a new value. It works smoothly if the new value is not null. But if the new value si null, it is just ignored. This works: Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>(); caseTarget.ProductSerialNumber = "new value"; After the execution of the plugin, the ProductSerialNumber field has value "new value". This doesn't work: Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>(); caseTarget.ProductSerialNumber = null; After the execution of the plugin, the ProductSerialNumber field has still its old value. How can I set the target's field to null?

    Read the article

  • Validating age field

    - by Marcelo
    Hi people, I'm trying to validate an age field in a form but I'm having some problem. First I tried to make sure that the field will not be send empty. I don't know JavaScript so I searched some scripts and adapted them to this: function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return 0; else return (isInteger.arguments[1] == true); for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (!isDigit(c)) return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } } function validate_form(thisform) { with (thisform) { if ((validate_required(age,"Age must be filled out!")==false) || isInteger(age,"Age must be and int number")==false)) {email.focus();return false;} } } //html part <form action="doador.php" onsubmit="return validate_form(this)" method="post"> It's working fine for empty fields, but if I type any letters or characters in age field, it'll be sent and saved a 0 in my database. Can anyone help me? Sorry for any mistake in English, and thanks in anvance for your help.

    Read the article

  • Parsing every part of an HTTP header field-value

    - by brickner
    Hi all. I'm parsing HTTP data directly from packets (either TCP reconstructed or not, you can assume it is). I'm looking for the best way to parse HTTP as accurately as possible. The main issue here is the HTTP header. Looking at the basic RFC of HTTP/1.1, it seems that HTTP header parsing would be complex. The RFC describes very complex regular expressions for different parts of the header. Should I write these regular expressions to parse the different parts of the HTTP header? The basic parsing I've written so far for HTTP header is for the generic HTTP header: message-header = field-name ":" [ field-value ] And I've included replacing inner LWS with SP and repeating headers with the same field-name with comma separated values as described in section 4.2. However, looking at section 14.9 for example would show that in order to parse the different parts of the field-value I need a much more complex parsing scheme. How do you suggest I should handle the complex parts of HTTP parsing (specifically the field-value) assuming I want to give the parser users the full capabilities of HTTP and to parse every part of HTTP? Design suggestions for this would also be appreciated. Thanks.

    Read the article

  • Need alternative field names for these reserved words

    - by MattSlay
    “type” and “class” are likely reserved or problematic words in C# and/or Ruby, two languages I may use to program against my new database schema in the future. So, in order to avoid potential conflicts with those languages, I’m looking for alternative names for these field names in my tables. In this case, it is from my Machines table, where I have: “class” field (values would be something like “manual” or “computerized”) and “type” field (values would be “lathe” or “mill”) I could call the fields “machineclass” and “machinetype”, but that is inconsistent with naming scheme in the rest of my schema (meaning, I do not re-use the table name in the field… For instance, I use Machine.name, not Machine.machinename) Any thought on this madness?

    Read the article

  • How to change a field value during the ItemUpdating event

    - by Buzzby
    Hi I am trying to set the value of a field on a ListItem in an event receiver but its not working All i am doing during the event is properties.AfterProperties[<field internal name>] = 1; No errors are thrown but the the field i'm setting does not change. I have also tried properties.ListItem[<field internal name>] = 1; properties.ListItem.Update(); Have also tried SystemUpdate(); I know i am meant to be setting the afterproperties but think i am missing an obvious step. Thanks

    Read the article

  • values from different fields in matalb

    - by ariel
    Hi does anybody familiar with a way that I could implement a matrix with values from a field (not the real or complex number, but lets say Z mod p). so I could perform all the operation of matlab on the matrix (with the values of the chosen field) Ariel

    Read the article

  • Validating Age field javascript beginner

    - by Marcelo
    Hi people, I'm trying to validate an age field in a form but I'm having some problem. First I tried to make sure that the field will not be send empty. I don't know javascript so I searched some scripts and adapted them to this: function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return 0; else return (isInteger.arguments[1] == true); for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (!isDigit(c)) return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } } function validate_form(thisform) { with (thisform) { if ((validate_required(age,"Age must be filled out!")==false) || isInteger(age,"Age must be and int number")==false)) {email.focus();return false;} } } //html part <form action="doador.php" onsubmit="return validate_form(this)" method="post"> It's working fine for empty fields, but if I type any letters or characters in age field, it'll be sent and saved a 0 in my database. Can any one help me ? Sorry for any mistake in English, and thanks in andvance for your help.

    Read the article

  • Bynary string search on one field.

    - by CrazyJoe
    I have 300 boolean fields in one table, and im trying to do somithing like that: One string field: 10000010000100100100100100010001 Ha a simple way to do a simple search os this field like: select * from table where field xor "10000010000100100100000000010001" :) Help!!

    Read the article

  • Turn a single partylist field into multiple

    - by dsabater
    Is there a way to transform a partylist field like Customer in a Campaign Response to allow for multiple Contacts/Accounts/Leads? Although unsupported, I now from Jian Wang that some attributes of the lookup can be modified in the onload() event like this: crmForm.all.customer.setAttribute("lookuptypes", "1,2"); Is there a similiar attribute that would turn this into a field that allows multiple participants like the To field in an e-mail? Thank you

    Read the article

  • Create a rich text control field in VBA for Word 2010

    - by mkn
    I have a control field where I dynamically add certain text. That works well so far. The problem is that in one text I have an input field where the user can type in text. I need to hardcode the form text input field into the VBA code. How is this achieved? Or can someone point me in the right direction? In the following code snippet I need to replace the [InputField] by a VBA input field. ActiveDocument.SelectContentControlsByTitle("Bottom").Item(1).Range.Text = _ "Some Text" & vbNewLine & _ "Some Text" & vbNewLine & _ "Some Text" & vbNewLine & _ "Text [InputField] Text"

    Read the article

  • Making a field unavailable to a user with javascript in MS CRM 4

    - by mwright
    I am trying to disable a field, i.e. grey it out and not allow the user to select it. To achieve this effect I am currently calling crmForm.all.new_attribute1.disabled = true; crmForm.all.new_attribute2.Disabled = true; The Disable, with a capital D, makes the field grayed out but the user can still put the cursor in that field or tab to it. The disable, with a little d, makes the field unavailable to the cursor and via tab, but gives no visual indication that it can't be interacted with. Is there a better way to do this, one call that will achieve similar results or am I stuck having both there?

    Read the article

  • Store java.util.Calendar field into one column

    - by Rasika
    How to store java.util.Calendar field into one column with Datanucleus JDO. By default it is stored into two columns (millisecs, Timezone) with following JDO metadata. field name="startDate" serialized="true" embedded="true" persistence-modifier="persistent" What need to be changed in metadata to store it into single column (Timestamp)? Is it posible query (JDOQL) on calendar field when it is in two clumn?

    Read the article

  • Using Sharepoint TextField, Label Field to get bounding data from multi list

    - by HieuNT
    Hi all, I have to make a custom webpart in sharepoint 2010 to customize defaults form of SP List. But, the custom form i make have a field must get/set data to field of other list. Sample : I make a custom create custom Editform.aspx for List A by add a webpart to this page, that add. but in it have a text box that load data from a field in List B. is it possible to use method FieldName in TextField class ? Thank alot.

    Read the article

  • jquery - add to hidden input field on keypress?

    - by Simpson88Keys
    I've got a hidden input field that I want to append text to depending upon what a user enters in two other fields. So, <input type="hidden" name="name" value="" /> <input type="text" name="first" value="" /> <input type="text" name="second" value="" /> If the user types First in the first input field and Second in the second input field, I want the name input field to be "First Second"... Tried using keyup and keypress, but can't get it to append to what's already there?

    Read the article

  • Confused about GNU `sort(1)` of a numerical sub field

    - by Chen Levy
    I wish to sort a space separated table, with the numerical value that found on the 2nd field. I can assume that the 2nd field is always fooN but the length of N is unknown: antiq. foo11 girls colleaguing foo2 Leinsdorf Cousy foo0 Montgomeryville bowlegged foo1 pollack Chevrier foo10 ill-conceived candlebomb foo3 seventieths autochthony foo101 re-enable beneficiate foo100 osteometric I read man sort(1) and played with all sort of options. On my system I found the line: sort -n -k2.5 table to work. My question is why? According to the man page: -k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin 1) ... POS is F[.C][OPTS], where F is the field number and C the characterposition in the field. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key. So why sort -n -k2.4 table don't work and sort -n -k.5 does?

    Read the article

  • Asp.net Hidden field not having value in code behind, but *is* retaining value after postbacks

    - by KallDrexx
    In my ASCX, I have an asp.net hidden field defined as <asp:HiddenField ID="hdnNewAsset" runat="server" />. In the Code Behind I have the following code: protected void Page_Load(object sender, EventArgs e) { _service = new ArticleDataService(PortalId); if (!IsPostBack) { string rawId = Request[ArticleQueryParams.ArticleId]; DisplayArticleDetails(rawId); } if (hdnNewAsset.Value.Trim() != string.Empty) ProcessNewAsset(); } Now, in my frontend, I have a javascript function to react to an event and set the hidden field and trigger a postback: function assetSelected(assetGuid) { $('input[id*="hdnNewAsset"]').val(assetGuid); __doPostBack() } What's happening is that my hidden field is being set in the markup (chrome shows [ <input type=?"hidden" name=?"dnn$ctr466$Main$ctl00$hdnNewAsset" id=?"dnn_ctr466_Main_ctl00_hdnNewAsset" value=?"98d88e72-088c-40a4-9022-565a53dc33c4">? ] for $('input[id*="hdnNewAsset"]')). However, when the postback occurs, hdnNewAsset.Value is an empty string. What's even more puzzling is that at the beginning of Page_Load Request.Params["dnn$ctr466$Main$ctl00$hdnNewAsset"] shows 98d88e72-088c-40a4-9022-565a53dc33c4, and after the postback my hidden field has the same value (so the hidden field is persisting across postbacks), yet I cannot access this value via hdnNewAsset.Value. Can anyone see what I"m doing wrong?

    Read the article

  • How to access the backing field of an inherited class using fluent nhibernate

    - by Akk
    How do i set the Access Strategy in the mapping class to point to the inherited _photos field? public class Content { private IList<Photo> _photos; public Content() { _photos = new List<Photo>(); } public virtual IEnumerable<Photo> Photos { get { return _photos; } } public virtual void AddPhoto() {...} } public class Article : Content { public string Body {get; set;} } I am currently using thw following to try and locate the backing field but an exception is thrown as it cannot be found. public class ArticleMap : ClassMap<Article> { HasManyToMany(x => x.Photos) .Access.CamelCaseField(Prefix.Underscore) //_photos //... } i tried moving the backing field _photos directly into the class and the access works. So how can i access the backing field of an inherited class?

    Read the article

  • move carat to the end of a text input field AND make the end visible

    - by user322384
    I'm going insane. I have an autosuggest box where users choose a suggestion. On the next suggestion selection the value of the text input box exceeds its size. I can move the carat to the end of the input field crossbrowser, no problem. But on Chrome and Safari I cannot SEE the carat at the end. The end of the text is not visible. Is there a way to move the carat to the end of a text input field AND have the end of the field visible so that the user is not confused about where the input carat went? what I got so far: <html> <head><title>Field update test</title></head> <body> <form action="#" method="POST" name="testform"> <p>After a field is updated the carat should be at the end of the text field AND the end of the text should be visible</p> <input type="text" name="testbox" value="" size="40"> <p><a href="javascript:void(0);" onclick="add_more_text();">add more text</a></p> </form> <script type="text/javascript"> <!-- var count = 0; function add_more_text() { var textfield = document.testform.elements['testbox']; textfield.blur(); textfield.focus(); if (count == 0) textfield.value = ''; // clear old count++; textfield.value = (count ? textfield.value : '') + ", " + count + ": This is some sample text"; // move to the carat to the end of the field if (textfield.setSelectionRange) { textfield.setSelectionRange(textfield.value.length, textfield.value.length); } else if (textfield.createTextRange) { var range = textfield.createTextRange(); range.collapse(true); range.moveEnd('character', textfield.value.length); range.moveStart('character', textfield.value.length); range.select(); } // force carat visibility for some browsers if (document.createEvent) { // Trigger a space keypress. var e = document.createEvent('KeyboardEvent'); if (typeof(e.initKeyEvent) != 'undefined') { e.initKeyEvent('keypress', true, true, null, false, false, false, false, 0, 32); } else { e.initKeyboardEvent('keypress', true, true, null, false, false, false, false, 0, 32); } textfield.dispatchEvent(e); // Trigger a backspace keypress. e = document.createEvent('KeyboardEvent'); if (typeof(e.initKeyEvent) != 'undefined') { e.initKeyEvent('keypress', true, true, null, false, false, false, false, 8, 0); } else { e.initKeyboardEvent('keypress', true, true, null, false, false, false, false, 8, 0); } textfield.dispatchEvent(e); } } // --> </script> </body> </html> Thanks

    Read the article

  • Django | how to append form field to the urlconf

    - by MMRUser
    I want to pass a form's field value to the next page (template) after user submit the page, the field could be user name, consider the following setup def form_submit(request): if request.method == 'POST': form = UsersForm(request.POST) if form.is_valid(): cd = form.cleaned_data try: newUser = form.save() return HttpResponseRedirect('/mysite/nextpage/') except Exception, ex: return HttpResponse("Ane apoi %s" % str(ex)) else: return HttpResponse('Error') "nextpage" is the template that renders after user submit the form, so I want to know how to append the form's field (user name) to the url and get that value from the view in order to pass it to the next page.. thanks.

    Read the article

  • jQuery - Change background of input field if text getting replaced

    - by ywickham
    I'm currently using jQuery to restrict a text box to number only input as follows: $('input.numbersOnly').keyup(function () { this.value = this.value.replace(/[^0-9\.]/g,''); }); I'd like to let the user know that what they are typing is being rejected by changing the background color of the field. I know that I can change the background of a field using something like this: $('input.numbersOnly').addClass('alertClass'); My question is, how do I combine the two code examples above so that the color of the field changes as the character is getting replaced? My goal is to alert the user that something is wrong with their input as they type it in the field. Thanks!

    Read the article

  • Saving a form using autocomplete instead of select field

    - by Jason Swett
    I have a form that looks like this: <%= form_for(@appointment) do |f| %> <% if @appointment.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@appointment.errors.count, "error") %> prohibited this appointment from being saved:</h2> <ul> <% @appointment.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <%= f.fields_for @client do |client_form| %> <div class="field"> <%= client_form.label :name, "Client Name" %><br /> <%= client_form.text_field :name %> </div> <% end %> As you can see, the field for @client is a text field as opposed to select field. When I try to save my form, I get this error: Client(#23852094658120) expected, got ActiveSupport::HashWithIndifferentAccess(#23852079773520) That's not surprising. It seems to me that it was expecting a select field, which it could translate into a Client object, but instead it just got a string. I know I can do Client.find( :first, :conditions => { :name => params[:name] } ) to find a Client with that name, but how do I tell my form that that's what's going on?

    Read the article

  • Query select field on JqGrid edit form

    - by abuzuhair
    I have this colom Model on JqGrid: {name:'ta',index:'ta',jsonmap:'ta',width:70,editable:true,edittype:'select', editoptions: {dataUrl:hostname+'/sisfa/ta_cb'}} I am using JqGrid form editing to edit this field. How to 'catch' the field editor for this field on form editing. I'm using this method, but not work .editGridRow("new", {closeAfterAdd: true, addCaption:'Add Data', width:500,dataheight:300,beforeShowForm:function(formid){ console.log($('#tr_ta').find('select[name=ta]')); }}); This method work for other edittype.

    Read the article

  • input field placeholder in jQuery

    - by Hristo
    I'm trying to create a Login page, not worrying about actually logging in yet, but I'm trying to achieve the effect where there is some faded text inside the input field and when you click on it, the text disappears or if you click away the text reappears. I have this working for my "Username" input field, but the "Password" field is giving me problems because I can't just do $("#password").attr("type","password"). Here's my code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <!-- Links --> <link rel="stylesheet" type="text/css" href="style.css" /> <!-- Scripts --> <script type="text/javascript" src="jQuery.js"></script> <script> // document script $(document).ready(function(){ // login box event handler $('#login').click(function(){ $('.loginBox').animate({ height: '150px' }, '1000' ); $('#username').show(); // add pw placeholder field $('#password').after('<input type="text" id="placeHolder" value="Password" class="placeHolder" />'); $('#password').hide(); }); // username field focus and blur event handlers $('#username').focus(function() { if($(this).hasClass('placeHolder')){ $(this).val(''); $(this).removeClass('placeHolder'); } }); $('#username').blur(function() { if($(this).val() == '') { $(this).val('Username'); $(this).addClass('placeHolder'); } }); // password field focus and blur event handlers $('#placeHolder').focus(function() { $('#placeHolder').hide(); $('#password').show(); $('#password').focus(); }); $('#password').blur(function() { if($('#password').val() == '') { $('#placeHolder').show(); $('#password').hide(); } }); }); </script> </head> <body> <div id="loginBox" class="loginBox"> <a id="login">Proceed to Login</a><br /> <div id="loginForm"> <form> <input type="text" id="username" class="placeHolder" value="Username" /> <input type="password" id="password" class="placeHolder" value="" /> </form> </div> </div> </body> </html> Right now, I can click on the password input box and type in it, but the text is not disappearing and the "type" doesn't get set to "password"... the new input field I create isn't being hidden, it just stays visible, and I'm not sure where the problem is. Any ideas? Thanks, Hristo

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >