Search Results

Search found 243 results on 10 pages for 'keyup'.

Page 8/10 | < Previous Page | 4 5 6 7 8 9 10  | Next Page >

  • Click event keeps firing

    - by Ben Shelock
    I have absolutely no idea why this is happening but the following code seems to be executed a huge ammount of times in all browsers. $('#save_albums').click(function(){ for(var i = 1; i <= 5; i++){ html = $('#your_albums ol li').eq(i).html(); alert(html); } }); Looks fairly innocent to me... Here's the code in it's entirety $(function(){ $('#query').keyup(function(){ var text = encodeURI($(this).val()); if(text.length > 3){ $('#results').load('search.php?album='+text, function(){ $('.album').hover(function(){ $(this).css('outline', '1px solid black') },function(){ $(this).css('outline', 'none') }); $('.album').click(function(){ $('#fores').remove(); $('#yours').show(); if($('#your_albums ol li').length <= 4){ albumInfo = '<li><div class="album">' + $(this).html() + '</div></li>'; if($('#your_albums ol li').length >= 1){ $('#your_albums ol li').last().after(albumInfo); } else{ $('#your_albums ol').html(albumInfo); } } else{ alert('No more than 5 please'); } }); $('#clear_albums').click(function(e){ e.preventDefault; $('#your_albums ol li').remove(); }); $('#save_albums').click(function(){ for(var i = 1; i <= 5; i++){ html = $('#your_albums ol li').eq(i).html(); alert(html); } }); }); } else{ $('#results').text('Query must be more than 3 characters'); } }); });

    Read the article

  • Javascript Detect Control Key Held on Mouseup

    - by Michael Mikowski
    I've searched a good deal, and can't seem to find a satisfactory solution. I hope someone can help. While I am using jQuery, I am also writing many thousands of lines of Javascript. So a "pure" javascript solution is just fine. I'm trying to determine if the control key is physically held down on a mouseup event. That's it; there are no other preconditions. Does anyone know how to do this reliably, cross-browser? I've tried storing this in a state variable by noting when the key is pressed and released: // BEGIN store control key status in hash_state $().bind('keydown','ctrl',function( arg_obj_e ){ hash_state.sw_ctrldn = true; console.debug( hash_state.sw_ctrldn ); }); $().bind('keyup','ctrl',function( arg_obj_e ){ hash_state.sw_ctrldn = false; console.debug( hash_state.sw_ctrldn ); }); // END store control key status in hash_state However, this really doesn't work. If you test this using firebug and watch the console, you will see that auto-repeat seems to happen, and the value toggles. I inspected the mouseup event to see if there is anything useful there, but to no avail: var debugEvent = function( arg_obj_e ){ var str = ''; for ( var attr in arg_obj_e ){ str += attr + ': ' + arg_obj_e[attr] + '\n'; } console.debug(str); } Any help would be appreciated.

    Read the article

  • How to determine if an item is the last one in a WPF ItemTemplate?

    - by Mike
    Hi everyone, I have some XAML <ItemsControl Name="mItemsControl"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBox Text="{Binding Mode=OneWay}" KeyUp="TextBox_KeyUp"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> that's bound to a simple ObservableCollection private ObservableCollection<string> mCollection = new ObservableCollection<string>(); public MainWindow() { InitializeComponent(); this.mCollection.Add("Test1"); this.mCollection.Add("Test2"); this.mItemsControl.ItemsSource = this.mCollection; } Upon hitting the enter key in the last TextBox, I want another TextBox to appear. I have code that does it, but there's a gap: private void TextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } TextBox textbox = (TextBox)sender; if (IsTextBoxTheLastOneInTheTemplate(textbox)) { this.mCollection.Add("A new textbox appears!"); } } The function IsTextBoxTheLastOneInTheTemplate() is something that I need, but can't figure out how to write. How would I go about writing it? I've considered using ItemsControl.ItemContainerGenerator, but can't put all the pieces together. Thanks! -Mike

    Read the article

  • Handling events from user control containing a WPF textbox

    - by Tom
    I've been successful in putting a WPF textbox into an existing windows form using ElementHost and a user control. It looks like the following: Public Class MyUserControl Private _elementHost as ElementHost = New ElementHost Private _wpfTextbox as System.Windows.Controls.Textbox = New System.Windows.Controls.Textbox Public Sub New() Me.Controls.Add(_elementHost) _elementHost.Dock = DockStyle.Fill _elementHost.Child = _wpfTextbox _wpfTextbox.SpellCheck.IsEnabled = True End Sub End Class Now, when I put this user control onto a windows form, it accepts keyboard input and the form itself can get text from the textbox. However, when I try to handle keypress (or keydown, keyup) events from the user control, nothing happens. I've looked into this problem and did a bit of research but now I'm a little confused as to what I really need to be looking at. The following are the topics that I am somewhat confused about. HwndSource Relaxed delegates WPF routed events If I am interpreting everything correctly, input from WPF textboxes are handled differently compared to regular form textboxes. It seems like both aren't compatible with each other but there must be some way to "pass" keys from one to another? I'd appreciate any help.

    Read the article

  • why isn't my validator working?

    - by Lina
    hi, can anybody tell me why is the following code not working? <script type="text/javascript" src="../../Scripts/jquery.js"></script> <script type="text/javascript" src="../../Scripts/jquery.validate.js"></script> <script type="text/javascript"> $(function() { // validate contact form on keyup and submit $("#myform").validate({ //set the rules for the fild names rules: { hour: { required: true, minlength: 2, range:[0,23] }, minute: { required: true, minlength: 2, range:[0,60] }, }, //set messages to appear inline messages: { hour: "Please enter a valid hour", minute: "Please enter a valid minute" } }); }); </script> <style type="text/css"> .error { color: red; font: 12pt verdana; padding-left: 10px } </style> <form id="myform" method="" action=""> <input id="hour" type="text" name="hour" style="width:30px; text-align:center;"></input> : <input id="minute" type="text" name="minute" style="width:30px; text-align:center;"></input> <br/> <input type="submit" value="Validate!" /> </form> thanks a million in advance, Lina

    Read the article

  • Efficient AutoSuggest with jQuery?

    - by nobosh
    I'm working to build a jQuery AutoSuggest plugin, inspired by Apple's spotlight. Here is the general code: $(document).ready(function() { $('#q').bind('keyup', function() { if( $(this).val().length == 0) { // Hide the q-suggestions box $('#q-suggestions').fadeOut(); } else { // Show the AJAX Spinner $("#q").css("background-image","url(/images/ajax-loader.gif)"); $.ajax({ url: '/search/spotlight/', data: {"q": $(this).val()}, success: function(data) { $('#q-suggestions').fadeIn(); // Show the q-suggestions box $('#q-suggestions').html(data); // Fill the q-suggestions box // Hide the AJAX Spinner $("#q").css("background-image","url(/images/icon-search.gif)"); } }); } }); The issue I want to solve well & elegantly, is not killing the sever. Right now the code above hits the server every time you type a key and does not wait for you to essentially finish typing. What's the best way to solve this? A. Kill previous AJAX request? B. Some type of AJAX caching? C. Adding some type of delay to only submit .AJAX() when the person has stopped typing for 300ms or so?

    Read the article

  • SendInput scan code on Windows 7 x64

    - by Stanomatic
    I am working with a WPF application sending keys to a game. I opened spy++ to observer s as a key press on the keyboard. I then press my button on the application and I noticed a different scan code in spy++ messages. Could this be somthing to do with Windows 7 64bit? Partial listing: var down = new INPUT(); down.Type = (UInt32)InputType.KEYBOARD; down.Data.Keyboard = new KEYBDINPUT(); down.Data.Keyboard.Vk = (UInt16)keyCode; down.Data.Keyboard.Scan = 0; down.Data.Keyboard.Flags = 0; down.Data.Keyboard.Time = 0; down.Data.Keyboard.ExtraInfo = IntPtr.Zero; //down.Data.Keyboard.ExtraInfo = GetMessageExtraInfo(); var up = new INPUT(); up.Type = (UInt32)InputType.KEYBOARD; up.Data.Keyboard = new KEYBDINPUT(); up.Data.Keyboard.Vk = (UInt16)keyCode; up.Data.Keyboard.Scan = 0; up.Data.Keyboard.Flags = (UInt32)KeyboardFlag.KEYUP; up.Data.Keyboard.Time = 0; up.Data.Keyboard.ExtraInfo = IntPtr.Zero; //up.Data.Keyboard.ExtraInfo = GetMessageExtraInfo(); INPUT[] inputList = new INPUT[2]; inputList[0] = down; inputList[1] = up; var numberOfSuccessfulSimulatedInputs = SendInput(2, inputList, Marshal.SizeOf(typeof(INPUT))); The image shows when I use my code to send a key I receive ScanCode:00fExtended from spy++ message output. When I actually press the same key I receive ScanCode:1FfExtended. Everything else is identical.

    Read the article

  • Binding UpdateSourceTrigger=Explicit, updates source at program startup

    - by GTD
    I have following code: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Grid> <TextBox Text="{Binding Path=Name, Mode=OneWayToSource, UpdateSourceTrigger=Explicit, FallbackValue=default text}" KeyUp="TextBox_KeyUp" x:Name="textBox1"/> </Grid> public partial class Window1 : Window { public Window1() { InitializeComponent(); } private void TextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { BindingExpression exp = this.textBox1.GetBindingExpression(TextBox.TextProperty); exp.UpdateSource(); } } } public class ViewModel { public string Name { set { Debug.WriteLine("setting name: " + value); } } } public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Window1 window = new Window1(); window.DataContext = new ViewModel(); window.Show(); } } I want to update source only when "Enter" key is pressed in textbox. This works fine. However binding updates source at program startup. How can I avoid this? Am I missing something?

    Read the article

  • JavaScript: input validation in the keydown event

    - by c411
    Hi, I'm attempting to do info validation against user text input in the process of keydown event. The reason that I am trying to validate in the keydown event is because I do not want to display the characters those that are considered to be illegal in the input box at the beginning. The validation I am writing is like this, function validateUserInput(){ var code = this.event.keyCode; if ((code<48||code>57) // numerical &&code!==46 //delete &&code!==8 //back space &&code!==37 // <- arrow &&code!==39) // -> arrow { this.event.preventDefault(); } } I can keep going like this, however I am seeing drawbacks on this implmentation. Those are, for example, Conditional statement become longer and longer when I put more conditions to be examined. keyCodes can be different by browsers. I have to not only check what is not legal but also have to check what are exceptionals. In above examples, delete,backspace, and arrow keys are exceptionals. But the feature that I don't want to lose is having not to display the input in the textarea unless it passes the validation. (In case the user try to put illegal characters in the textarea, nothing should appear at all) That is why I am not doing validation upon keyup event. So my question is, Are there better ways to validate input in keydown event than checking keyCode by keyCode? Are there other ways to capture the user inputs other than keydown event before browser displays it? And a way to put the validation on it? Thanks for the help in advance.

    Read the article

  • Auto populate a text field based on another text field

    - by Syed Aslam
    I am trying to auto-populate a text field based on the value of another input field. Currently trying to do this using observe_field helper like this: <%= observe_field( :account_name, :function => "alert('Name changed!')", :on => 'keyup' ) %> <% form_for(@account, :html => { :id => 'theform' }) do |f| %> <label for="accountname"> Account name </label> <%= form.text_field :name, :tabindex => '1' %> <label for="subdomain"> Subdomain </label> <%= form.text_field :subdomain, :tabindex => '2' %> <% end %> When the user enters text in the account_name text_field, I want to copy that convert into a subdomain (downcase and join by '-') and populate to subdomain text_field. But, in the process getting this error: element is null var method = element.tagName.toLowerCase(); protot...9227640 (line 3588) Where exactly am I going wrong here? Or is there a better way to do this?

    Read the article

  • how do i keep form data after submitting the form using javascript?

    - by Lina
    When i submit this form, the values just disappears from the textboxes. I like them to stay printed in the textboxes. How do i do that? <form id="myform" method="get" action="" onSubmit="hello();"> <input id="hour" type="text" name="hour" style="width:30px; text-align:center;" /> : <input id="minute" type="text" name="minute" style="width:30px; text-align:center;" /> <br/> <input type="submit" value="Validate!" /> </form> <style type="text/css"> .error { color: red; font: 10pt verdana; padding-left: 10px } </style> <script type="text/javascript"> function hello(){ var hour = $("#hour").html(); alert(hour); } $(function() { // validate contact form on keyup and submit $("#myform").validate({ //set the rules for the fild names rules: { hour: { required: true, minlength: 1, maxlength: 2, range:[0,23] }, minute: { required: true, minlength: 1, maxlength: 2, range:[0,60] }, }, //set messages to appear inline messages: { hour: "Please enter a valid hour", minute: "Please enter a valid minute" } }); }); </script>

    Read the article

  • Can't block capslock with CGEventTap

    - by Thor Frølich
    I'm using Quartz CGEventTap in an attempt to globally intercept capslock presses and block them (to have them do something useful instead). I succesfully detect capslock presses but have so far been unable to block them. My code (originating from this stackoverflow answer) is something like this: eventTap = CGEventTapCreate(kCGHIDEventTap, kCGTailAppendEventTap, kCGEventTapOptionDefault, eventMask, myCGEventCallback, &oldFlags); runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0); CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes); CGEventTapEnable(eventTap, true); CGEventRef myCGEventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef theEvent, void *refcon) { CGEventFlags *oldFlags = (CGEventFlags *)refcon; switch (type) { case kCGEventFlagsChanged: { CGEventFlags newFlags = CGEventGetFlags(theEvent); CGEventFlags changedFlags = *oldFlags ^ newFlags; *oldFlags = newFlags; if (changedFlags == 65536) { NSLog(@"Capslock pressed. Let's not return the event"); return NULL; } break; } default: break; } NSLog(@"Different modifier than capslock. Returning the event"); return theEvent; } If I understand correctly returning NULL should effectively block the keypress from propagating. Indeed it also does for "normal" keyup and -down events. However capslock toggles regardless. Any ideas why that is? Am I making incorrect assumptions? And/or how can I do things differently to achieve my goal? Thanks, Thor

    Read the article

  • Another IE Issue with AJAX

    - by Nik
    Alright, This code works in every browser except IE (again, to be expected). The code is supposed to refresh based on setInterval, and does so normally in all other browsers except IE, which just doesn't refresh. Can you spot the problem? var nick = document.getElementById("chatnick").value; var sessid = document.getElementById("sessid").value; var room = document.getElementById("roomid").value; function user_read() { $.ajax({ type: "GET", url: "methods.php", data: {method: "u", room: room}, dataType: "html", success: function (data, status, xhr) { $("#userwindow").html(data); setTimeout(user_read, 10000); } }); } function ajax_read() { $.ajax({ type: "GET", url: "methods.php", data: {method: "r", room: room}, dataType: "html", success: function (data, status, xhr) { $("#chatwindow").html(data); setTimeout(ajax_read, 400); } }); } function submit_msg() { var msg = document.getElementById("chatmsg").value; $.ajax({ type: "GET", url: "methods.php", data: {method: "w", room: room, m: msg, n: nick, sessid: sessid}, dataType: "html", success: function (data, status, xhr) { } }); document.getElementById("chatmsg").value = ""; } function keyup(arg1) { if (arg1 == 13) submit_msg(); } setTimeout(function(){ajax_read();}, 400); user_read();

    Read the article

  • Calling a function within a jQuery plug-in

    - by Bob Knothe
    I am in the process of creating my first jQuery plug-in that will format numbers automatically to various international formats. There are a couple functions within the plug-in that strips the strings and re-formats the string that needs to be called from another jQuery script. Based on the plug-in structure below (let me know if you need the entire code) can I call and send the parameter(s) to the stripFormat(ii) and targetFormat(ii, iv) functions? Or do I need to change my plug-in structure and if so how? (function($){ var p = $.extend({ aNum: '0123456789', aNeg: '-', aSep: ',', aDec: '.', aInput: '', cPos: 0 }); $.fn.extend({ AutoFormat: function() { return this.each(function() { $(this).keypress(function (e){ code here; }); $(this).keyup(function (e){ code here; }); // Would like to call this function from another jQuery script - see below. function stripFormat(ii){ code here; } // Would like to call this function from another jQuery script - see below. function targetFormat(ii, iv){ code here; } }); } }); })(jQuery); Methods trying to call the plug-in functions: jQuery(function(){ $("input").change(function (){ //temp function to demonstrate the stripFormat() function. document.getElementById(targetElementid).value = targetFormat(targetElementid, targetValue); }); }); I have tried to use these variations without success: document.getElementById(targetElementid).value = $.targetFormat(targetElementid, targetValue); document.getElementById(targetElementid).value = $.autoFormat().targetFormat(targetElementid, targetValue);

    Read the article

  • My jQuery and PHP give different results on the same thing?

    - by Stefan
    Hey all, Annoying brain numbing problem. I have two functions to check the length of a string (primarily, the js one truncates as well) heres the one in Javascript: $('textarea#itemdescription').keyup(function() { var charLength = $(this).val().length; // Displays count $('span#charCount').css({'color':'#666'}); $('span#charCount').html(255 - charLength); if($(this).val().length >= 240){ $('span#charCount').css({'color':'#FF0000'}); } // Alerts when 250 characters is reached if($(this).val().length >= 255){ $('span#charCount').css({'color':'#FF0000'}); $('span#charCount').html('<strong>0</strong>'); var text = $('textarea#itemdescription').val().substring(0,255) $('textarea#itemdescription').val(text); } }); And here is my PHP to double check: if(strlen($_POST["description"])>255){ echo "Description must be less than ".strlen($_POST["description"])." characters"; exit(); } I'm using jQuery Ajax to post the values from the textarea. However my php validation says the strlen() is longer than my js is essentially saying. So for example if i type a solid string and it says 0 or 3 chars left till 255. I then click save and the php gives me the length as being 261. Any ideas? Is it to do with special characters, bit sizes that js reads differently or misses out? Or is it to do with something else? Maybe its ill today!... :P Thanks, Stefan

    Read the article

  • WPF validation on Enter Key Up

    - by Martin
    I'm trying to validate a UI change when Enter key is pressed. The UI element is a textbox, which is data binded to a string. My problem is that the data binding hasn't updated TestText when Enter key is Up. It is only updated when I press the button which brings up a message box. /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window, INotifyPropertyChanged { String _testText = new StringBuilder("One").ToString(); public string TestText { get { return _testText; } set { if (value != _testText) { _testText = value; OnPropertyChanged("TestText"); } } } public Window1() { InitializeComponent(); myGrid.DataContext = this; } private void OnPropertyChanged(string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); } } public event PropertyChangedEventHandler PropertyChanged; private void onKeyUp(object sender, KeyEventArgs e) { if (e.Key != System.Windows.Input.Key.Enter) return; System.Diagnostics.Trace.WriteLine(TestText); } private void button1_Click(object sender, RoutedEventArgs e) { MessageBox.Show(TestText); } } Window XAML: Window x:Class="VerificationTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300" KeyUp="onKeyUp" TextBox XAML: TextBox Name="myTextBox" Text="{Binding TestText}" Button XAML: Button Name="button1" Click="button1_Click"

    Read the article

  • WPF Usercontrol with textboxes

    - by benPearce
    I have a WPF user control with a number of textboxes, this is hosted on a WPF window. The textboxes are not currently bound but I cannot type into any of them. I have put a breakpoint in the KeyDown event of one of the textboxes and it hits it fine and I can see the key I pressed. The textboxes are declared as <TextBox Grid.Row="3" Grid.Column="4" x:Name="PostcodeSearch" Style="{StaticResource SearchTextBox}" KeyDown="PostcodeSearch_KeyDown"/> The style is implemented as <Style x:Key="SearchTextBox" TargetType="{x:Type TextBox}"> <Setter Property="Control.Margin" Value="2"/> <Setter Property="Height" Value="20"/> <Setter Property="Width" Value="140"/> <Setter Property="HorizontalAlignment" Value="Left"/> </Style> I am hoping I have overlooked something obvious. EDIT: I only added the KeyDown and KeyUp events just to prove that the keys presses were getting through. I do not have any custom functionality.

    Read the article

  • WPF TextBox Focus

    - by Jezz
    I am setting focus on a Textbox like this: <DockPanel Margin="0,0,0,0" LastChildFill="True" FocusManager.FocusedElement="{Binding ElementName=messengerTextToSend}"> <ListBox x:Name="messengerLabelParticipants" DockPanel.Dock="Top" Height="79" Margin="0,1,0,0" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0" AllowDrop="True" ItemsSource="{Binding Path=involvedUsers}" ItemTemplate="{StaticResource chatParticipants}" Tag="{Binding Path=chatSessionID}" Drop="participantList_Drop" DragEnter="participantList_DragEnter" DragLeave="messengerLabelParticipants_DragLeave"> </ListBox> <TextBox x:Name="messengerTextToSend" Focusable="True" Margin="10,0,10,10" DockPanel.Dock="Bottom" Height="100" Tag="{Binding Path=.}" KeyUp="messengerTextToSend_KeyUp" Cursor="IBeam" Style="{StaticResource messengerTextBoxSendText}"/> <ScrollViewer x:Name="messengerScroller" Template="{DynamicResource ScrollViewerControlTemplate1}" ScrollChanged="messengerScroller_ScrollChanged" Loaded="messengerScroller_Loaded" Margin="0,10,0,10"> <ListBox x:Name="messengerListMessages" Margin="10,0,0,0" Padding="0" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=messages}" ItemTemplateSelector="{StaticResource messageTemplateSelector}"> </ListBox> </ScrollViewer> </DockPanel> However, when the page load, although the Textbox visually appears to have focus, the cursor is static and I have to manually either click on the Textbox or tab to it in order to start typing. I'm not sure what I'm doing wrong but I've tried every setting, inclduing setting it in the code to get it working. Any assistance would be greatly appreciated.

    Read the article

  • Low-level Keyboard Hooks/SendInput with Winkey+L possible? (workstation lockout is intercepted in Vi

    - by Brian Jorgensen
    I work on a project called UAWKS (Unofficial Apple Wireless Keyboard Support) that helps Windows users use Apple's bluetooth keyboard. One of the main goals of UAWKS is to swap the Cmd key (which behaves as Winkey in Windows) with Ctrl, allowing users to do Cmd+C for copy, Cmd+T for new tab, etc. It is currently developed using AutoHotkey, which worked pretty well under Windows XP. However, on Vista and Windows 7, Cmd+L causes problems: Regardless of low-level keyboard hooks, Winkey+L is always intercepted by Windows and normally locks the workstation... You can disable workstation locking with this registry hack, but pressing Winkey+L still can't be rebound in AHK Pressing Winkey+L leaves Winkey in the Keydown state until the next (additional) Winkey Up. Simulating a Keyup event doesn't seem to work either! It seems that Winkey+L is a special chord that messes everything else up. I've looked through the AHK source code, and they try to address this problem in SendKey() in keyboard_mouse.cpp (near line 883 in v1.0.48.05), but it doesn't work. I wrote up my own low-level keyboard hook application in C#, and I see the same problem. Has anyone else run into this? Is there a workaround?

    Read the article

  • jQuery Validate PHP Response

    - by Kurt
    Hello Everybody, my problem is, I want to validate an email adresse with jquery. Not only the syntax but rather if the email is already registrated. There are some tutorials but they are not working! At first the Jquery Code: <script id="demo" type="text/javascript"> $(document).ready(function() { // validate signup form on keyup and submit var validator = $("form#signupform").validate({ rules: { Vorname: { required: true, minlength: 3 }, Nachname:{ required: true, minlength: 4 }, password: { required: true, minlength: 5 }, password_confirm: { required: true, minlength: 5, equalTo: "#password" }, Email: { required: true, email: true, type: "POST", remote: "remotemail.php" }, dateformat: "required", ... </script> And now the PHP Code: <?php include('dbsettings.php'); $conn = mysql_connect($dbhost,$dbuser,$dbpw); mysql_select_db($dbdb,$conn); $auslesen1 = "SELECT Email FROM flo_user"; $auslesen2 = mysql_query($auslesen1,$conn); $registered_email = mysql_fetch_assoc($auslesen2); $requested_email = $_POST['Email']; if( in_array($requested_email, $registered_email) ){ echo "false"; } else{ echo "true"; } ?> I tried return TRUE/ return FALSE as well, but this displays "Email is registrated" all the time. json_encode didn't work as well. Thanks a lot!

    Read the article

  • How to traverse table in Jquery and add a class?

    - by SWL
    I have a simple table of two rows. The first column is required, but the others are not; however, I would like them to be required in pairs. So if the user enters a value for Quantity3, then Size3 should also now be required. As a fiddle: http://jsfiddle.net/NaRts/7/ <tr> <td><input name="qty1[492]" class="qty required" type="text"></td> <td><input name="qty2[492]" class="qty" type="text"></td> <td><input name="qty3[492]" class="qty" type="text"></td> </tr><tr> <td><input name="size1[492]" type="text" class="size required" ></td> <td><input name="size2[492]" type="text" class="size" ></td> <td><input name="size3[492]" type="text" class="size" ></td> </tr> And the simple jQuery I have is: $('.qty').keyup(function() { var s = $(this).attr('name'); // = qty3[418] var qtyID = s.replace(/[^1-9\[\]]/g, ""); // = 3[418] var SizeID = "size" + qtyID; var $sizeInput = $(this).closest('tr').next().find(SizeID); $sizeInput.css('background-color', 'green'); $sizeInput.addClass('required'); //I tried this too but it didn't work //$(this).parent().find(SizeID).addClass('required'); });? ? Any help is much appreciated.

    Read the article

  • In a combobox, how do I determine the highlighted item (not selected item)?

    - by Harold Bamford
    First, fair warning: I am a complete newbie with C# and WPF. I have a combobox (editable, searchable) and I would like to be able to intercept the Delete key and remove the currently highlighted item from the list. The behavior I'm looking for is like that of MS Outlook when entering in email addresses. When you give a few characters, a dropdown list of potential matches is displayed. If you move to one of these (with the arrow keys) and hit Delete, that entry is permanently removed. I want to do that with an entry in the combobox. Here is the XAML (simplified): <ComboBox x:Name="Directory" KeyUp="Directory_KeyUp" IsTextSearchEnabled="True" IsEditable="True" Text="{Binding Path=CurrentDirectory, Mode=TwoWay}" ItemsSource="{Binding Source={x:Static self:Properties.Settings.Default}, Path=DirectoryList, Mode=TwoWay}" / The handler is: private void Directory_KeyUp(object sender, KeyEventArgs e) { ComboBox box = sender as ComboBox; if (box.IsDropDownOpen && (e.Key == Key.Delete)) { TrimCombobox("DirectoryList", box.HighlightedItem); // won't compile! } } When using the debugger, I can see box.HighlightedItem has the value I want but when I try and put in that code, it fails to compile with: System.Windows.Controls.ComboBox' does not contain a definition for 'HighlightedItem'... So: how do I access that value? Keep in mind that the item has not been selected. It is merely highlighted as the mouse hovers over it. Thanks for your help.

    Read the article

  • Wpf ItemsControl with datatemplate, problem with doubled border for some items

    - by ksirg
    Hi, I have simple ItemsControl with custom datatemplate, template contains only textblock with border. All items should be displayed vericaly one after another, but some items have extra border. How can I remove it? I want to achieve something similar to enso launcher, it looks like My implementation looks like this here is my xaml code: <Window x:Class="winmole.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" x:Name="hostWindow" Height="Auto" MinHeight="100" MinWidth="100" Width="Auto" Padding="10" AllowsTransparency="True" WindowStyle="None" Background="Transparent" Top="0" Left="0" SizeToContent="WidthAndHeight" Topmost="True" Loaded="Window_Loaded" KeyUp="Window_KeyUp" > <Window.Resources> <!--Simple data template for Items--> <DataTemplate x:Key="itemsTemplate"> <Border Background="Black" Opacity="0.9" HorizontalAlignment="Left" CornerRadius="0,2,2,0"> <TextBlock Text="{Binding Path=Title}" TextWrapping="Wrap" FontFamily="Georgia" FontSize="30" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" TextAlignment="Left" Padding="5" Margin="0" Foreground="Yellow"/> </Border> </DataTemplate> </Window.Resources> <DockPanel> <ItemsControl DockPanel.Dock="Bottom" Name="itcPrompt" ItemsSource="{Binding ElementName=hostWindow, Path=DataItems}" ItemTemplate="{StaticResource itemsTemplate}" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </DockPanel>

    Read the article

  • Invoke Command When "ENTER" Key Is Pressed In XAML

    - by bitxwise
    I want to invoke a command when ENTER is pressed in a TextBox. Consider the following XAML: <UserControl ... xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" ...> ... <TextBox> <i:Interaction.Triggers> <i:EventTrigger EventName="KeyUp"> <i:InvokeCommandAction Command="{Binding MyCommand}" CommandParameter="{Binding Text}" /> </i:EventTrigger> </i:Interaction.Triggers> </TextBox> ... </UserControl> and that MyCommand is as follows: public ICommand MyCommand { get { return new DelegateCommand<string>(MyCommandExecute); } } private void MyCommandExecute(string s) { ... } With the above, my command is invoked for every key press. How can I restrict the command to only invoke when the ENTER key is pressed? I understand that with Expression Blend I can use Conditions but those seem to be restricted to elements and can't consider event arguments. I have also come across SLEX which offers its own InvokeCommandAction implementation that is built on top of the Systems.Windows.Interactivity implementation and can do what I need. Another consideration is to write my own trigger, but I'm hoping there's a way to do it without using external toolkits.

    Read the article

  • jquery form validation, and submit-on-change

    - by Bee
    I want to make all my settings forms across my site confirm that changes are saved, kinda like facebook does if you make changes in a form and then try to navigate away without saving. So I'm disabling the submit button on the forms only enabling if the values change. I then prompt the user to hit save before they leave the page in the case that they do have changes pending. var form = $('form.edit'); if(form.length > 0) { var orig_str = form.serialize(); $(':submit',form).attr('disabled','disabled'); form.on('change keyup', function(){ if(form.serialize() == orig_str) { setConfirmUnload(false); $(':submit',form).attr('disabled','disabled'); } else { setConfirmUnload(true); $(':submit',form).removeAttr('disabled') } }); $('input[type=submit]').click(function(){ setConfirmUnload(false); }); } function setConfirmUnload(on) { window.onbeforeunload = (on) ? unloadMessage : null; } function unloadMessage() { return 'If you navigate away from this page without saving your changes, they will be lost.'; } One of these forms needs some additional validation which I do using jQuery.validate library. e.g. if i wanted to ensure the user can't double submit the form on accident by double clicking on submit or somesuch (the actual validation in question is for a credit-card form and not this simple): $('form').validate({ submitHandler: function(form) { $(':submit', form).attr('disabled','disabled'); form.submit(); } }); Unfortunately both bits are trying to bind to submit button and they're interfering with each other such that the submit button remains disabled no matter what I do and it is impossible to submit the form at all. Is there some way to chain the validations together or something? Or some other way to avoid re-writing the validation code to repeat the "did you change anything in the form" business?

    Read the article

< Previous Page | 4 5 6 7 8 9 10  | Next Page >