Search Results

Search found 316 results on 13 pages for 'blur'.

Page 11/13 | < Previous Page | 7 8 9 10 11 12 13  | Next Page >

  • GWT, MVP, and UIBinding - How to get the best of all worlds

    - by Stephane Grenier
    With MVP, you normally bind the View (UI) with the Presenter in the Presenter. However with the latest version of GWT, especially with UIBinding, you can do the following in the View: @UiHandler("loginButton") void onAboutClicked(ClickEvent event) { // my login code } Which basically exchanges a lot of anonymous inner class code for some quick annotation code. Very nice!! The problem is that this code is in the view and not the presenter... So I thought maybe: @UiHandler("loginButton") void onAboutClicked(ClickEvent event) { myPresenter.onAboutClicked(...); } But there are several problems with this approach. The most important, you blur the lines between View and Presenter. Who does which binding, in some cases it's the View, in others it's the presenter (binding to events not in your current view but that need to be attached - for example a system wide update event). You still get the benefit of being able to unit test your presenter, but at what cost. The responsibilities are messy now. For example the binding is sometimes in the View and others times in the Presenter level. I can see the code falling into all kinds of chaos with time. I also thought of extending the Presenter to the View, so that you could do this in the View. The problem here is that you lose the Presenter's ability to run standard unit tests! That's a major issue. That and the lines again become blurred. So my question, does anyone have a good method of taking advantage of the annotation from UIBinding within the MVP pattern without blurring the lines and losing the advantages of the MVP pattern?

    Read the article

  • PHP sessions causing Apache to hang indefinitely

    - by Kmaid
    The problem is that every so often a page that writes to a Session will cause apache to hang forever for a particular session. Once this error occurs for one user any further modifications to any session of any user will cause the website to hang for this user. This problem has been my sole focus for days. I have a development VPS running Windows 2003 and default latest version of XAMPP using the standard PHP session handler. The code in question actually runs on two other machines perfectly normally so although my common sense says it’s a web server configuration issue but at this point I am willing to try anything. On further investigation there are no errors in the Apache, PHP or System event log. Resources are abundant and there is no “AJAX shit storm” or more than a couple writes to a session per page. I have also implemented session_write_close() wherever possible to try and help elevate the problem. I have checked the session’s directory which is set to “C:\windows\Temp” and found that once a user enters this hanging phase that the corresponding session file is exclusively locked and the only way to resolve this is to stop Apache and wait a few moments for the files to become unlocked and delete them. I am not wondering if deletion is required. The Sessions themselves only contain 4 bits of information. ShoppingCartID, UserID, UserLevel and Refering URL and are alphanumerical with an occasional slash. My PHP.INI’s session section is configured like this: session.save_handler = files session.save_path = "C:\WINDOWS\Temp" session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 1 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 I have tried everything I can think of and the whole problem is now a blur to me. Any ideas would be appreciated and thanks for your time reading this :)

    Read the article

  • When onblur occurs, how can I find out which element focus went *to*?

    - by Michiel Borkent
    Suppose I attach an onblur function to an html input box like this: <input id="myInput" onblur="function() { ... }"></input> Is there a way to get the ID of the element which caused the onblur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span like this: <span id="mySpan">Hello World</span> If I click the span right after the input element has focus, the input element will lose its focus. How does the function know that it was mySpan that was clicked? PS: If the onclick event of the span would occur before the onblur event of the input element my problem would be solved, because I could set some status value indicating a specific element had been clicked. PPS: The background of this problem is that I want to trigger an Ajax.AutoCompleter control externally (from a clickable element) to show its suggestions, without the suggestions disappearing immediately because of the onblur event on the input element. So I want to check in the OnBlur function if one specific element has been clicked, and if so, ignore the blur event.

    Read the article

  • How do you get Length of Text in a Mojo TextField?

    - by figus
    How do you get the length of the text inside a Mojo TextField? I'm trying to set a multiLine TextField with a limit of 150 chars, I tried doing it with a counter, but ran into a issue of not being able to decrement the counter when the text was erased, or adding the right number when pasting text, so my new approach was to get the length of the text each time you press a letter. I've already tried this: (gets called in the charsAllow attribute of the textField) if (this.controller.get("mensaje").mojo.getValue().length &lt;= 150) { return true; } this.controller.get("mensaje").mojo.blur(); return false; but it doesn't work.... I debugged and the function exits just after the line in bold... it doesn't even returns true or false. I also tried assigning the length value to a variable or assigning the text to a variable and then get the length, but nothing. It's the same issue. It returns just after the getValue(). Also, maybe because of this issue, the text scrolls instead of wrapping, but when the textField loses focus it wraps the text.

    Read the article

  • Asp.net Custom user control button. How to stop multiple clicks by user.

    - by Laurence Burke
    I am trying to modify an open source Forum called YetAnotherForum.net in the project they have a custom user control called Yaf:ThemeButton. Now its rendered as an anchor with an onclick method in this code ThemeButton.cs using System; using System.Web.UI; using System.Web.UI.WebControls; namespace YAF.Controls { /// <summary> /// The theme button. /// </summary> public class ThemeButton : BaseControl, IPostBackEventHandler { /// <summary> /// The _click event. /// </summary> protected static object _clickEvent = new object(); /// <summary> /// The _command event. /// </summary> protected static object _commandEvent = new object(); /// <summary> /// The _attribute collection. /// </summary> protected AttributeCollection _attributeCollection; /// <summary> /// The _localized label. /// </summary> protected LocalizedLabel _localizedLabel = new LocalizedLabel(); /// <summary> /// The _theme image. /// </summary> protected ThemeImage _themeImage = new ThemeImage(); /// <summary> /// Initializes a new instance of the <see cref="ThemeButton"/> class. /// </summary> public ThemeButton() : base() { Load += new EventHandler(ThemeButton_Load); this._attributeCollection = new AttributeCollection(ViewState); } /// <summary> /// ThemePage for the optional button image /// </summary> public string ImageThemePage { get { return this._themeImage.ThemePage; } set { this._themeImage.ThemePage = value; } } /// <summary> /// ThemeTag for the optional button image /// </summary> public string ImageThemeTag { get { return this._themeImage.ThemeTag; } set { this._themeImage.ThemeTag = value; } } /// <summary> /// Localized Page for the optional button text /// </summary> public string TextLocalizedPage { get { return this._localizedLabel.LocalizedPage; } set { this._localizedLabel.LocalizedPage = value; } } /// <summary> /// Localized Tag for the optional button text /// </summary> public string TextLocalizedTag { get { return this._localizedLabel.LocalizedTag; } set { this._localizedLabel.LocalizedTag = value; } } /// <summary> /// Defaults to "yafcssbutton" /// </summary> public string CssClass { get { return (ViewState["CssClass"] != null) ? ViewState["CssClass"] as string : "yafcssbutton"; } set { ViewState["CssClass"] = value; } } /// <summary> /// Setting the link property will make this control non-postback. /// </summary> public string NavigateUrl { get { return (ViewState["NavigateUrl"] != null) ? ViewState["NavigateUrl"] as string : string.Empty; } set { ViewState["NavigateUrl"] = value; } } /// <summary> /// Localized Page for the optional link description (title) /// </summary> public string TitleLocalizedPage { get { return (ViewState["TitleLocalizedPage"] != null) ? ViewState["TitleLocalizedPage"] as string : "BUTTON"; } set { ViewState["TitleLocalizedPage"] = value; } } /// <summary> /// Localized Tag for the optional link description (title) /// </summary> public string TitleLocalizedTag { get { return (ViewState["TitleLocalizedTag"] != null) ? ViewState["TitleLocalizedTag"] as string : string.Empty; } set { ViewState["TitleLocalizedTag"] = value; } } /// <summary> /// Non-localized Title for optional link description /// </summary> public string TitleNonLocalized { get { return (ViewState["TitleNonLocalized"] != null) ? ViewState["TitleNonLocalized"] as string : string.Empty; } set { ViewState["TitleNonLocalized"] = value; } } /// <summary> /// Gets Attributes. /// </summary> public AttributeCollection Attributes { get { return this._attributeCollection; } } /// <summary> /// Gets or sets CommandName. /// </summary> public string CommandName { get { if (ViewState["commandName"] != null) { return ViewState["commandName"].ToString(); } return null; } set { ViewState["commandName"] = value; } } /// <summary> /// Gets or sets CommandArgument. /// </summary> public string CommandArgument { get { if (ViewState["commandArgument"] != null) { return ViewState["commandArgument"].ToString(); } return null; } set { ViewState["commandArgument"] = value; } } #region IPostBackEventHandler Members /// <summary> /// The i post back event handler. raise post back event. /// </summary> /// <param name="eventArgument"> /// The event argument. /// </param> void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { OnCommand(new CommandEventArgs(CommandName, CommandArgument)); OnClick(EventArgs.Empty); } #endregion /// <summary> /// Setup the controls before render /// </summary> /// <param name="sender"> /// </param> /// <param name="e"> /// </param> private void ThemeButton_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(this._themeImage.ThemeTag)) { // add the theme image... Controls.Add(this._themeImage); } // render the text if available if (!String.IsNullOrEmpty(this._localizedLabel.LocalizedTag)) { Controls.Add(this._localizedLabel); } } /// <summary> /// The render. /// </summary> /// <param name="output"> /// The output. /// </param> protected override void Render(HtmlTextWriter output) { // get the title... string title = GetLocalizedTitle(); output.BeginRender(); output.WriteBeginTag("a"); output.WriteAttribute("id", ClientID); if (!String.IsNullOrEmpty(CssClass)) { output.WriteAttribute("class", CssClass); } if (!String.IsNullOrEmpty(title)) { output.WriteAttribute("title", title); } else if (!String.IsNullOrEmpty(TitleNonLocalized)) { output.WriteAttribute("title", TitleNonLocalized); } if (!String.IsNullOrEmpty(NavigateUrl)) { output.WriteAttribute("href", NavigateUrl.Replace("&", "&amp;")); } else { // string.Format("javascript:__doPostBack('{0}','{1}')",this.ClientID,"")); output.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(this, string.Empty)); } bool wroteOnClick = false; // handle additional attributes (if any) if (this._attributeCollection.Count > 0) { // add attributes... foreach (string key in this._attributeCollection.Keys) { // get the attribute and write it... if (key.ToLower() == "onclick") { // special handling... add to it... output.WriteAttribute(key, string.Format("{0};{1}", this._attributeCollection[key], "this.blur();this.display='none';")); wroteOnClick = true; } else if (key.ToLower().StartsWith("on") || key.ToLower() == "rel" || key.ToLower() == "target") { // only write javascript attributes -- and a few other attributes... output.WriteAttribute(key, this._attributeCollection[key]); } } } // IE fix if (!wroteOnClick) { output.WriteAttribute("onclick", "this.blur();this.style.display='none';"); } output.Write(HtmlTextWriter.TagRightChar); output.WriteBeginTag("span"); output.Write(HtmlTextWriter.TagRightChar); // render the optional controls (if any) base.Render(output); output.WriteEndTag("span"); output.WriteEndTag("a"); output.EndRender(); } /// <summary> /// The get localized title. /// </summary> /// <returns> /// The get localized title. /// </returns> protected string GetLocalizedTitle() { if (Site != null && Site.DesignMode == true && !String.IsNullOrEmpty(TitleLocalizedTag)) { return String.Format("[TITLE:{0}]", TitleLocalizedTag); } else if (!String.IsNullOrEmpty(TitleLocalizedPage) && !String.IsNullOrEmpty(TitleLocalizedTag)) { return PageContext.Localization.GetText(TitleLocalizedPage, TitleLocalizedTag); } else if (!String.IsNullOrEmpty(TitleLocalizedTag)) { return PageContext.Localization.GetText(TitleLocalizedTag); } return null; } /// <summary> /// The on click. /// </summary> /// <param name="e"> /// The e. /// </param> protected virtual void OnClick(EventArgs e) { var handler = (EventHandler) Events[_clickEvent]; if (handler != null) { handler(this, e); } } /// <summary> /// The on command. /// </summary> /// <param name="e"> /// The e. /// </param> protected virtual void OnCommand(CommandEventArgs e) { var handler = (CommandEventHandler) Events[_commandEvent]; if (handler != null) { handler(this, e); } RaiseBubbleEvent(this, e); } /// <summary> /// The click. /// </summary> public event EventHandler Click { add { Events.AddHandler(_clickEvent, value); } remove { Events.RemoveHandler(_clickEvent, value); } } /// <summary> /// The command. /// </summary> public event CommandEventHandler Command { add { Events.AddHandler(_commandEvent, value); } remove { Events.RemoveHandler(_commandEvent, value); } } } } now that is just cs file its handled like this in the .ascx page of the actual website <YAF:ThemeButton ID="Save" runat="server" CssClass="yafcssbigbutton leftItem" TextLocalizedTag="SAVE" OnClick="Save_Click" /> now it is given an OnClick codebehind function that does some serverside function like this protected void Save_Click(object sender, EventArgs e) { //some serverside code here } now I have a problem with the user being able to click multiple times and firing that serverside function multiple times. I have added in the code as of right now an extra onclick="this.style.display='none'" in the .cs code but that is a ugly fix I was wondering if anyone would have a better idea of disabling the ThemeButton clientside?? pls any feedback if I need to give more examples or further explain the question thanks.

    Read the article

  • ImageMagick Reflection

    - by dbruns
    Brief: convert ( -size 585x128 gradient: ) NewImage.png How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command. Details: I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do here but the solution isn't exactly what I am looking for. Since I will be calling ImageMagick from a C#.Net application I want to use one call without any temp files and return the image through stdout. So far I have this... convert OriginalImage.png ( OriginalImage.png -flip -blur 3x5 \ -crop 100%%x30%%+0+0 -negate -evaluate multiply 0.3 \ -negate ( -size 585x128 gradient: ) +matte -compose copy_opacity -composite ) -append NewImage.png This works ok but doesn't give me the exact fade I am looking for. Instead of a nice solid fade from top to bottom it is giving me a fade from top left to bottom right. I added the (-negate -evaluate multiply 0.3 -negate) section in to lighten it up a bit more since I wasn't getting the fade I wanted. I also don't want to have to hard code in the size of the image when creating the gradient ( -size 585x128 gradient: ) I'm also going to want to keep the original image's transparency if possible. To go to stdout I plan on replacing "NewImage.png" with "-"

    Read the article

  • C# How to commit a TextBox?

    - by Jake
    Hi, In a form, I have a TextBox Binding an Object on its member property "Title". Along with it is a "Save" button to test the binding. Seems like the underlying object property does not get updated unless the textbox loses focus. But there no form.ActiveControl.Blur() for use. Besides, this does not seem like a sound hack. Anyway to do this better? Thanks. EDIT: Sorry for not being clear. My question is in the title: "How to commit a TextBox". I use the term "commit" from the DataGridView commit and BindingSource commit. And it's in WinForms. (Have never worked with WPF, so it didn't occur to me. Sorry). The actual scenario I have is I have a bunch of TextBox binded to property of a single Object. The user enters values in all the TextBox and when the user clicks save (toolbar button), the last TextBox is still in focus (or in editing mode) hence the save will not capture the last value in the last textbox. I want to find the correct way to "commit" the textbox value just before saving. Thanks.

    Read the article

  • How would I send a POST Request via Ajax?

    - by Gotactics
    I have a php page, Post.php it recieves the POST's Action, and that has two functions. Insert, and Update.Now how would I go about posting INSERT with this Ajax code. The code posts update fine but is doesnt post insert at all. $(document).ready(function(){ //global vars var inputUser = $("#nick"); var inputMessage = $("#message"); var loading = $("#loading"); var messageList = $(".content ul"); //functions function updateShoutbox(){ //just for the fade effect messageList.hide(); loading.fadeIn(); //send the post to shoutbox.php $.ajax({ type: "POST", url: "Shoutbox.php", data: "action=update", complete: function(data){ loading.fadeOut(); messageList.html(data.responseText); messageList.fadeIn(2000); } }); } //check if all fields are filled function checkForm(){ if(inputUser.attr("value") && inputMessage.attr("value")) return true; else return false; } //Load for the first time the shoutbox data updateShoutbox(); //on submit event $("#form").submit(function(){ if(checkForm()){ var nick = inputUser.attr("value"); var message = inputMessage.attr("value"); //we deactivate submit button while sending $("#send").attr({ disabled:true, value:"Sending..." }); $("#send").blur(); //send the post to shoutbox.php $.ajax({ type: "GET", url: "Shoutbox.php", data: "action=insert&nick=" + nick + "&message=" + message, complete: function(data){ messageList.html(data.responseText); updateShoutbox(); //reactivate the send button $("#send").attr({ disabled:false, value:"Shout it!" }); } }); } else alert("Please fill all fields!"); //we prevent the refresh of the page after submitting the form return false; }); });emphasized text

    Read the article

  • Reducing moire when downsampling halftone comic images.

    - by drawnonward
    How can I reduce moire effects when downsampling halftone comic book images during live zoom on an iPhone or iPad? I am writing a comic book viewer. It would be nice to provide higher resolution images and allow the user to zoom in while reading the comic book. However, my client is averse to moire effects and will not allow this feature if there are noticeable moire artifacts while zooming, which of course there are. Modifying the images to be less susceptible to moire would only work if the modifications were not perceptible. Blur was specifically prohibited, as is anything that removes the beloved halftone dots. The images are black and white halftone and line art. The originals are 600 dpi but what we ship with the application will be half that at best, so probably 2500 pixels or less tall. So what are my options? If I write a custom downsampling algorithm would it be fast enough for real time on these devices? Are there other tricks I can do? Would it work to just avoid the size ratios that have the most visual moire effects? As you zoom in an out, there are definitely peaks where the moire effects are worst. Is there a way to calculate what those points are and just zoom to a nearby scale that is not as bad? Any suggestions are welcome. I have very little experience with image and signal processing, but am enjoying the opportunity to learn. I know nothing of wavelets and acutance and other jargon, so please be verbose.

    Read the article

  • Changing the <input> type in IE with JavaScript

    - by MrEnder
    The line <input type="text" name="passwordLogin" value="Password" onfocus="if(this.value=='Password'){this.value=''; this.type='password'};" onblur="if(this.value==''){this.value='Password'; this.type='text'};" size="25" /> works in all web browsers except IE... How can I fix it for IE? Ok made some changes to still have an error I want it to work like this like here <input type="text" name="usernameLogin" value="Email" onfocus="if(this.value=='Email'){this.value=''};" onblur="if(this.value==''){this.value='Email'};" size="25" /> if I dont enter anything it will put the value back So I tried this <td colspan="2" id="passwordLoginTd"> <input id="passwordLoginInput1" type="text" name="passwordLogin" value="Password" onfocus="passwordFocus()" size="25" /> <input id="passwordLoginInput2" style="display: none;" type="password" name="passwordLogin" value="" onblur="passwordBlur()" size="25" /> </td> <script type="text/javascript"> //<![CDATA[ passwordElement1 = document.getElementById('passwordLoginInput1'); passwordElement2 = document.getElementById('passwordLoginInput2'); function passwordFocus() { passwordElement1.style.display = "none"; passwordElement2.style.display = "inline"; passwordElement2.focus(); } function passwordBlur() { if(passwordElement2.value=='') { passwordElement2.style.display = "none"; passwordElement1.style.display = "inline"; passwordElement1.focus(); } } //]]> </script> as you can see the blur does not work =[ ok finally got it thanks to the help needed to remove passwordElement1.focus();

    Read the article

  • TinyMCE is glitchy/unusable in IE8

    - by Force Flow
    I'm using the jQuery version of TinyMCE 3.3.9.3 In firefox, it works fine (10 sec video depicting it in use): http://www.youtube.com/watch?v=TrAE0igfT3I In IE8 (in IE8 standards mode), I can't type or click any buttons. However, if I use ctrl+v to paste, then I can start typing, but the buttons still don't work (a 45 sec video depicting it in use): http://www.youtube.com/watch?v=iBSRlE8D8F4 The jQuery TinyMCE demo on TinyMCE's site works for me in IE8. Here's the init code: $().ready(function(){ function tinymce_focus(){ $('.defaultSkin table.mceLayout').css({'border-color' : '#6478D7'}); $('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#6478D7'}); $('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#6478D7'}); } function tinymce_blur(){ $('.defaultSkin table.mceLayout').css({'border-color' : '#93a6e1'}); $('.defaultSkin table.mceLayout tr.mceFirst td').css({'border-top-color' : '#93a6e1'}); $('.defaultSkin table.mceLayout tr.mceLast td').css({'border-bottom-color' : '#93a6e1'}); } $('textarea.tinymce').tinymce({ script_url : 'JS/tinymce/tiny_mce.js', theme : "advanced", mode : "exact", invalid_elements : "b,i,iframe,font,input,textarea,select,button,form,fieldset,legend,script,noscript,object,embed,table,img,a,h1,h2,h3,h4,h5,h6", //theme options theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,selectall,|,undo,redo,|,cleanup,removeformat,|", theme_advanced_buttons2 : "bold,italic,underline,|,bullist,numlist,|,forecolor,backcolor,|", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "none", theme_advanced_resizing : false, //plugins plugins : "inlinepopups,paste", dialog_type : "modal", paste_auto_cleanup_on_paste : true, setup: function(ed){ ed.onInit.add(function(ed){ //check for addEventListener -- primarily supported by firefox only var edDoc = ed.getDoc(); if ("addEventListener" in edDoc){ edDoc.addEventListener("focus", function(){ tinymce_focus(); }, false); edDoc.addEventListener("blur", function(){ tinymce_blur(); }, false); } }); } }); }); Any ideas as to why it's not working in IE8? [edit]: stripping everything out of the init (leaving just script_url and theme) results in the same symptoms

    Read the article

  • Prevent box shadow from showing on a specific side

    - by kaile
    Is there any way to create a css box-shadow in which regardless of the blur value, the shadow only appears on the desired sides? For example if I want to create a div with shadows on left and right sides and no shadow on the top or bottom. The div is not absolutely positioned and its height is determined by the content. -- Edit -- @ricebowl: I appreciate your answer. Maybe you can help with creating a complete solution to fix the problems stated in my reply to your solution... My page setup is as follows: <div id="container"> <div id="header"></div> <div id="content"></div> <div id="clearfooter"></div> </div> <div id="footer"></div> And CSS like this: #container {width:960px; min-height:100%; margin:0px auto -32px auto; position:relative; padding:0px; background-color:#e6e6e6; -moz-box-shadow: -3px 0px 5px rgba(0,0,0,.8), 3px 0px 5px rgba(0,0,0,.8);} #header {height:106px; position:relative;} #content {position:relative;} #clearFooter {height:32px; clear:both; display:block; padding:0px; margin:0px;} #footer {height:32px; padding:0px; position:relative; width:960px; margin:0px auto 0px auto;}

    Read the article

  • spyr validation text with jquery serialize()

    - by oz1453
    Code like this : <form> <ol> <li> <fieldset> <legend>test</legend> <ol> <li> <label for="qwerty">qwerty</label> <span id="sprytextfield1"> <input name="qwerty" type="text" id="qwerty" /> <span class="textfieldRequiredMsg">error no qwerty input</span></span> </li> </ol> </fieldset> </li> </ol> <p style="text-align:right;"> <input type="reset" value="reset" /> <input type="submit" value="submit" /> </p> </form> <script type="text/javascript"> $('form').submit(function() { alert($(this).serialize()); return false; }); <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]}); //--> </script> I want to do. when i click the submit button serialize the form but when no error with spyr. if the spyr validation text error appears don t serialize or alert. i think.i must make a if condition before alert.

    Read the article

  • Fix a 404: missing parameters error from a GET request to CherryPy

    - by norabora
    I'm making a webpage using CherryPy for the server-side, HTML, CSS and jQuery on the client-side. I'm also using a mySQL database. I have a working form for users to sign up to the site - create a username and password. I use jQuery to send an AJAX POST request to the CherryPy which queries the database to see if that username exists. If the username exists, alert the user, if it doesn't, add it to the database and alert success. $.post('submit', postdata, function(data) { alert(data); }); Successful jQuery POST. I want to change the form so that instead of checking that the username exists on submit, a GET request is made as on the blur event from the username input. The function gets called, and it goes to the CherryPy, but then I get an error that says: HTTPError: (404, 'Missing parameters: username'). $.get('checkUsername', getdata, function(data) { alert(data); }); Unsuccessful jQuery GET. The CherryPy: @cherrypy.expose def submit(self, **params): cherrypy.response.headers['Content-Type'] = 'application/json' e = sqlalchemy.create_engine('mysql://mysql:pw@localhost/6470') c = e.connect() com1 = "SELECT * FROM `users` WHERE `username` = '" + params["username"] + "'" b = c.execute(com1).fetchall() if not len(b) > 0: com2 = "INSERT INTO `6470`.`users` (`username` ,`password` ,`website` ,`key`) VALUES ('" com2 += params["username"] + "', MD5( '" + params["password"] + "'), '', NULL);" a = c.execute(com2) c.close() return simplejson.dumps("Success!") #login user and send them to home page c.close() return simplejson.dumps("This username is not available.") @cherrypy.expose def checkUsername(self, username): cherrypy.response.headers['Content-Type'] = 'application/json' e = sqlalchemy.create_engine('mysql://mysql:pw@localhost/6470') c = e.connect() command = "SELECT * FROM `users` WHERE `username` = '" + username + "'" a = c.execute(command).fetchall(); c.close() sys.stdout.write(str(a)) return simplejson.dumps("") I can't see any differences between the two so I don't know why the GET request is giving me a problem. Any insight into what I might be doing wrong would be helpful. If you have ideas about the jQuery, CherryPy, config files, anything, I'd really appreciate it.

    Read the article

  • jQuery autocomplete on multiple fields

    - by Onigoetz
    Hi all, Surprisingly, I didn't find any answers to my question. I want to make a form on jQuery with two fields. City Code. City Name. and when I enter a city code and go out of the field. I want an autocomplete on the city name. I Installed the jQuery Autocomplete plugin. and I have the following code : $(document).ready(function() { $("#field_localite").autocomplete('admin/ajax/npa', { extraParams: { npa: function() { return $("#field_npa").val(); } } }); $("#field_npa").blur(function() { $("#field_localite").search(); }); }); The problem is that the .search() method. doesnt launch the autocomplete. I'm looking for a method to trigger this autocomplete search on the field. do you know a way or a plugin able to do this search ? thanks in advance BTW : the PHP code behin is totally tested and works, it returns the data when doing the call.

    Read the article

  • Show iPad keyboard on select, focus or always (jQuery)

    - by Ryan
    I have a web app that is using jQuery to replace the RETURN key with TAB so that when I user presses return the form is not submitted but rather the cursor moves to the next text field. This works in all browsers but only 1/2 works on the iPad. On the iPad the next field is highlighted but the keyboard is hidden. How can I keep the keyboard visible or force it somehow? Here's my code (thanks to http://thinksimply.com/blog/jquery-enter-tab): function checkForEnter (event) { if (event.keyCode == 13) { currentBoxNumber = textboxes.index(this); if (textboxes[currentBoxNumber + 1] != null) { nextBox = textboxes[currentBoxNumber + 1] nextBox.focus(); nextBox.select(); event.preventDefault(); return false; } } } Drupal.behaviors.formFields = function(context) { $('input[type="text"]').focus(function() { $(this).removeClass("idleField").addClass("focusField"); }); $('input[type="text"]').blur(function() { $(this).removeClass("focusField").addClass("idleField"); }); // replaces the enter/return key function with tab textboxes = $("input.form-text"); if ($.browser.mozilla) { $(textboxes).keypress (checkForEnter); } else { $(textboxes).keydown (checkForEnter); } };

    Read the article

  • Find whether a particular cell of a table has an img tag

    - by SilentPro
    I am generating a table dynamically using Django. The same table template is used to generate a variety of tables depending on the data supplied. In one scenario a particular column contains image tags. Since my table is editable (using jquery) the image cell also becomes editable and removes my content. I want some special behavior on double click of such cells like say upload an image. How do I accomplish this with a jquery? My script for making the table editable is given below. $(function() { $("td").dblclick(function() { var OriginalContent = $(this).text(); $(this).addClass("cellEditing"); $(this).html("<input type='text' value='" + OriginalContent + "' />"); $(this).children().first().focus(); $(this).children().first().keypress(function(e) { if (e.which == 13) { var newContent = $(this).val(); $(this).parent().text(newContent); $(this).parent().removeClass("cellEditing"); } }); $(this).children().first().blur(function() { $(this).parent().text(OriginalContent); $(this).parent().removeClass("cellEditing"); }); }); });

    Read the article

  • How to open popup behind main window (HTML,jQuery)

    - by sara.ma
    I'm new. i have a popup code that when user click anywhere in the HTML page, a popup window shows up: (function () { document.onclick = function () { var sUrl = "http://URL.com"; if (typeof daily_capping == "undefined") var daily_capping = 10; if (typeof capping_minutes == "undefined") var capping_minutes = 60; if (document.cookie.indexOf("_popwin=") === -1) { var ads2day = document.cookie.split("_popwinDaily=")[1]; ads2day = typeof ads2day == "undefined" ? 0 : parseInt(ads2day.split(";")[0]); if (ads2day < daily_capping) { var isMSIE = navigator.userAgent.indexOf("MSIE") != -1 ? !0 : !1, _parent = self, sOptions, popunder; if (top != self) try { top.document.location.toString() && (_parent = top) } catch (err) {} sOptions = "toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width=" + screen.width.toString() + ",height=" + (screen.height - 20).toString() + ",screenX=0,screenY=0,left=0,top=0", popunder = _parent.window.open(sUrl, "rhpop", sOptions); if (popunder) { popunder.blur(); if (isMSIE) { window.focus(); try { opener.window.focus() } catch (err) {} } else popunder.init = function (e) { with(e)(function () { if (typeof window.mozPaintCount != "undefined" || typeof navigator.webkitGetUserMedia == "function") { var e = window.open("about:blank"); e.close() } try { opener.window.focus() } catch (t) {} })() }, popunder.params = { url: sUrl }, popunder.init(popunder) } var now = new Date, popDaily = (new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 23, 59, 59)).toGMTString(); document.cookie = "_popwinDaily=" + (ads2day + 1) + ";expires=" + popDaily + ";path=/"; var popInterval = new Date; popInterval.setTime(popInterval.getTime() + capping_minutes * 60 * 1e3), document.cookie = "_popwin=1;expires=" + popInterval.toGMTString() + ";path=/" } } } })(); but popup is on top. is it possible to make it open behind main page?? is there any lighter popup code for this purpose? thanks guys

    Read the article

  • Error: expected specifier-qualifier-list before 'QTVisualContextRef'

    - by Moonlight293
    Hi everyone, I am currently getting this error message in my header code, and I'm not sure as to why: "Error: expected specifier-qualifier-list before 'QTVisualContextRef'" #import <Cocoa/Cocoa.h> #import <QTKit/QTKit.h> #import <OpenGL/OpenGL.h> #import <QuartzCore/QuartzCore.h> #import <CoreVideo/CoreVideo.h> @interface MyRecorderController : NSObject { IBOutlet QTCaptureView *mCaptureView; IBOutlet NSPopUpButton *videoDevicePopUp; NSMutableDictionary *namesToDevicesDictionary; NSString *defaultDeviceMenuTitle; CVImageBufferRef mCurrentImageBuffer; QTCaptureDecompressedVideoOutput *mCaptureDecompressedVideoOutput; QTVisualContextRef qtVisualContext; // the context the movie is playing in // filters for CI rendering CIFilter *colorCorrectionFilter; // hue saturation brightness control through one CI filter CIFilter *effectFilter; // zoom blur filter CIFilter *compositeFilter; // composites the timecode over the video CIContext *ciContext; QTCaptureSession *mCaptureSession; QTCaptureMovieFileOutput *mCaptureMovieFileOutput; QTCaptureDeviceInput *mCaptureDeviceInput; } @end In the examples I have seen through other code (e.g. Cocoa Video Tutorial) I have not seen any difference in their code to mine. If anyone would be able to point out as to how this error could have occurred that would be great. Thanks heaps! :)

    Read the article

  • Unobstrusive pseudo-classes and attribute selectors emulation in IE

    - by Álvaro G. Vicario
    I'm trying to emulate some pseudo-classes and attribute selectors in Internet Explorer 6 and 7, such as :focus, :hover or [type=text]. So far, I've managed to add a class name to the affected elements: $("input, textarea, select") .hover(function(){ $(this).addClass("hover"); }, function(){ $(this).removeClass("hover"); }) .focus(function(){ $(this).addClass("focus"); }) .blur(function(){ $(this).removeClass("focus"); }); $("input[type=text]").each(function(){ $(this).addClass("text"); }); However, I'm still forced to duplicate selector in my style sheets: textarea:focus, textarea.focus{ } And, to make things worse, IE6 seems to ignore all the selectors when it finds an attribute: input[type=text], input.text{ /* IE6 ignores this */ } And, of course, IE6 ignores selectors with multiple classes: input.text.focus{ /* IE6 ignores this */ } So I'm likely to end up with this mess: input[type=text]{ /* Rules here */ } input.text{ /* Same rules again */ } input[type=text]:focus{ } input.text_and_focus{ } input.text_and_hover{ } input.text_and_focus_and_hover{ } My question: is there any way to read the rules or computed style defined for a CSS selector and apply it to certain elements, so I only need to maintain one set of standard CSS?

    Read the article

  • problem in variables in jquery

    - by Alvin
    Hi, I don't understand why I'm not getting the message as "username already exits" if type the username which is already in database. If the username in a server, then it is returning the value as "1" otherwise empty, and despite of successfully getting the value from the server based on username is present or not, and assigning the value to variable "x", I'm unable to get message when I pass already exist username. May I know? $(document).ready(pageInit); function pageInit() { $('#1').bind('blur',go); } function go() { var value = $('#1').val(); var x = 0; $.post('just.do',{username:value},function(data){ x = data; } ); if(x) { $('#para').show(); $('#para').html("Username already exits"); return false; } else { $('#para').hide(); return true; } }; EDIT: This is what I'm doing in post request in servlets: String user1 = request.getParameter("username"); if(user != null) { String query = "Select * from users where user_name="+"\""+user+"\""; b = db.doExecuteQuery(stmt,query); if(b) { out.write("1"); } }

    Read the article

  • WP7 help with menu effects

    - by MattMacdonald
    Kinda new to Silverlight and have some experience with WPF but I'm doing a project with a group for a class making a game for WP7. I am currently in charge of the menu system for the game and I had a few ideas for "flashy" menu transitions. I got some going for the main menu but I wanted to do something cool for the options submenu. Anyway my idea is to either fashion an expander or to have sort of a variation of a dialog box. But the way I envisioned it would be in either case the menu items blur but are still visible while the expanded menu is displayed or while the dialog is active. If I'm being confusing sorry :) but think of Windows 7 glass effect on the menu while other options are available. What I'm getting at is I want to give this a shot but I have no idea how I would go about doing something like this. Could anyone point me in the right direction or outline some key steps for me to build off? I tried finding something like this on Google but no such luck.

    Read the article

  • pass parameter from $.post() callback to outer variable

    - by Nazmin
    basically i want to hold a parameter that retrieve value from $.post() call like this: init = function(){ var lastpage = getLastPage(); } function getLastPage(){ $.post("getInfo.php",{ last: "yes" }, function(data){ setLast(data.last); },'json'); return function setLast(data){ return data; } } so when reach at last post (last page) i should check with lastpage variable that has a value returned from getLastPage() function. I'm pretty blur with javascript pointer and all. Please help guys. update (20/4/2010): I've done the other way around, like this: init = function(){ getLastPage(); if((page+1) == $("#lastpage").val()){ alert("this is last post"); }else{ page++; //get info and display to the page here } } function getLastPage(){ $.post("getInfo.php",{ last: "yes" }, function(data){ $("#lastpage").val(data.last); },'json'); } first run the function to temporarily store the value in hidden input tag (lastpage) and then grab the value again to check it whenever i click forward button. if you all have more appropriate way please tell me.

    Read the article

  • Load image blurred Android

    - by Mira
    I'm trying to create a map for a game through an image, where each black pixel is equivalent to a wall, and yellow to flowers(1) and green grass(0) so far i had this image (50x50): http://i.imgur.com/Ydj9Cp2.png the problem here seems to be that, when i read the image on my code, it get's scaled up to 100x100, even tough i have it on the raw folder. I can't let it scale up or down because that will put noise and blur on the image and then the map won't be readable. here i have my code: (...) Bitmap tab=BitmapFactory.decodeResource(resources, com.example.lolitos2.R.raw.mappixel); //tab=Bitmap.createScaledBitmap(tab, 50, 50, false); Log.e("w", tab.getWidth()+"."+tab.getHeight()); for (int i = 0; i < tab.getWidth(); i++) { for (int j = 0; j < tab.getHeight(); j++) { int x = j; int y = i; switch (tab.getPixel(x, y)) { // se o é uma parede case Color.BLACK: getParedes()[x][y] = new Parede(x, y); break; case Color.GREEN: fundo.add(new Passivo(x,y,0)); break; default: fundo.add(new Passivo(x,y,1)); } } } How can i read my image Map without rescaling it?

    Read the article

  • Silverlight Firestarter Wrap Up and WCF RIA Services Talk Sample Code

    - by dwahlin
    I had a great time attending and speaking at the Silverlight Firestarter event up in Redmond on December 2, 2010. In addition to getting a chance to hang out with a lot of cool people from Microsoft such as Scott Guthrie, John Papa, Tim Heuer, Brian Goldfarb, John Allwright, David Pugmire, Jesse Liberty, Jeff Handley, Yavor Georgiev, Jossef Goldberg, Mike Cook and many others, I also had a chance to chat with a lot of people attending the event and hear about what projects they’re working on which was awesome. If you didn’t get a chance to look through all of the new features coming in Silverlight 5 check out John Papa’s post on the subject. While at the Silverlight Firestarter event I gave a presentation on WCF RIA Services and wanted to get the code posted since several people have asked when it’d be available. The talk can be viewed by clicking the image below. Code from the talk follows as well as additional links. I had a few people ask about the green bracelet on my left hand since it looks like something you’d get from a waterpark. It was used to get us access down a little hall that led backstage and allowed us to go backstage during the event. I thought it looked kind of dorky but it was required to get through security. Sample Code from My WCF RIA Services Talk (To login to the 2 apps use “user” and “P@ssw0rd”. Make sure to do a rebuild of the projects in Visual Studio before running them.) View All Silverlight Firestarter Talks and Scott Guthrie’s Keynote WCF RIA Services SP1 Beta for Silverlight 4 WCF RIA Services Code Samples (including some SP1 samples) Improved binding support in EntitySet and EntityCollection with SP1 (Kyle McClellan’s Blog) Introducing an MVVM-Friendly DomainDataSource: The DomainCollectionView (Kyle McClellan’s Blog) I’ve had the chance to speak at a lot of conferences but never with as many cameras, streaming capabilities, people watching live and overall hype involved. Over 1000 people registered to attend the conference in person at the Microsoft campus and well over 15,000 to watch it through the live stream.  The event started for me on Tuesday afternoon with a flight up to Seattle from Phoenix. My flight was delayed 1 1/2 hours (I seem to be good at booking delayed flights) so I didn’t get up there until almost 8 PM. John Papa did a tech check at 9 PM that night and I was scheduled for 9:30 PM. We basically plugged in my laptop backstage (amazing number of servers, racks and audio devices back there) and made sure everything showed up properly on the projector and the machines recording the presentation. In addition to a dedicated show director, there were at least 5 tech people back stage and at least that many up in the booth running lights, audio, cameras, and other aspects of the show. I wish I would’ve taken a picture of the backstage setup since it was pretty massive – servers all over the place. I definitely gained a new appreciation for how much work goes into these types of events. Here’s what the room looked like right before my tech check– not real exciting at this point. That’s Yavor Georgiev (who spoke on WCF Services at the Firestarter) in the background. We had plenty of monitors to reference during the presentation. Two monitors for slides (right and left side) and a notes monitor. The 4th monitor showed the time and they’d type in notes to us as we talked (such as “You’re over time!” in my case since I went around 4 minutes over :-)). Wednesday morning I went back on campus at Microsoft and watched John Papa film a few Silverlight TV episodes with Dave Campbell and Ryan Plemons.   Next I had the chance to watch the dry run of the keynote with Scott Guthrie and John Papa. We were all blown away by the demos shown since they were even better than expected. Starting at 1 PM on Wednesday I went over to Building 35 and listened to Yavor Georgiev (WCF Services), Jaime Rodriguez (Windows Phone 7), Jesse Liberty (Data Binding) and Jossef Goldberg and Mike Cook (Silverlight Performance) give their different talks and we all shared feedback with each other which was a lot of fun. Jeff Handley from the RIA Services team came afterwards and listened to me give a dry run of my WCF RIA Services talk. He had some great feedback that I really appreciated getting. That night I hung out with John Papa and Ward Bell and listened to John walk through his keynote demos. I also got a sneak peak of the gift given to Dave Campbell for all his work with Silverlight Cream over the years. It’s a poster signed by all of the key people involved with Silverlight: Thursday morning I got up fairly early to get to the event center by 8 AM for speaker pictures. It was nice and quiet at that point although outside the room there was a huge line of people waiting to get in.     At around 8:30 AM everyone was let in and the main room was filled quickly. Two other overflow rooms in the Microsoft conference center (Building 33) were also filled to capacity. At around 9 AM Scott Guthrie kicked off the event and all the excitement started! From there it was all a blur but it was definitely a lot of fun. All of the sessions for the Silverlight Firestarter were recorded and can be watched here (including the keynote). Corey Schuman, John Papa and I also released 11 lab exercises and associated videos to help people get started with Silverlight. Definitely check them out if you’re interested in learning more! Level 100: Getting Started Lab 01 - WinForms and Silverlight Lab 02 - ASP.NET and Silverlight Lab 03 - XAML and Controls Lab 04 - Data Binding Level 200: Ready for More Lab 05 - Migrating Apps to Out-of-Browser Lab 06 - Great UX with Blend Lab 07 - Web Services and Silverlight Lab 08 - Using WCF RIA Services Level 300: Take me Further Lab 09 - Deep Dive into Out-of-Browser Lab 10 - Silverlight Patterns: Using MVVM Lab 11 - Silverlight and Windows Phone 7

    Read the article

< Previous Page | 7 8 9 10 11 12 13  | Next Page >