Search Results

Search found 17209 results on 689 pages for 'input sanitization'.

Page 8/689 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Defining Form Input with Dialog

    - by Workoholic
    Hi. I want my php application to allow the user to select a file from their computer. I then want to store the file's path, but I don't want to upload the file. With the <input type="file" />, the file is uploaded, which would take too long. Is there a way to do this? Maybe if I change the input's type to text with jquery right before the form is sent? I could just let the user type the path, but that is not very convenient...

    Read the article

  • Validation of user input or ?????????

    - by zaf
    We're letting users search a database from a single text input and I'm having difficulties in filtering some user supplied strings. For example, if the user submits: ????????? lcd SONY (Note the ?'s) I need to cancel the search. I include the base64 encoded version of the above string wrapped up so that its easy run: print(base64_decode("1MfLxc/RwdPHIGxjZCBTT05Z")); I've ignored such inputs before but now (am not sure why) just realised the mysql database query is taking nearly forever to execute so this is now on high priority. Another example to highlight that we are using utf-8 and mb_detect_encoding is not helping much: print(base64_decode("zqDOm8+Fzr3PhM63z4HOuc6/IM+Bzr/Phc+HzyU=")); ????t???? ?????% So: how can I detect/filter these inputs? how is this input being generated?

    Read the article

  • Javascript: addClassName if input is checked and removeClassName if it was un-checked

    - by BoDiE2003
    Im trying to select all the li tags of the document and check if it hasClassName('yes') so if it has, it will remove it. But im having a TypeError: Object [object HTMLLIElement], has no method 'hasClassName' error. This is the DOM method: document.observe("dom:loaded", function() { $(document.body).select('input').each(function(element) { element.observe('click', function() { init(); }); init(); }); }); The previous code will take the init fuction and check the if there are checked inputs and add them the 'yes' class name, but if I un-check those inputs, the class remains. This is the funcion that Im trying to do dynamic (add and remove class 'yes'); function init() { $(document.body).select('input').each(function(element) { if (element.checked) { element.up('li').addClassName('yes'); } if ($(document.body).select('li').hasClassName('yes')) { element.removeClassName('yes'); } }) } Can you help me solving the last part of this function, so the removeclassname method will work? Thank you

    Read the article

  • How to refactor and improve this XNA mouse input code?

    - by Andrew Price
    Currently I have something like this: public bool IsLeftMouseButtonDown() { return currentMouseState.LeftButton == ButtonState.Pressed && previousMouseSate.LeftButton == ButtonState.Pressed; } public bool IsLeftMouseButtonPressed() { return currentMouseState.LeftButton == ButtonState.Pressed && previousMouseSate.LeftButton == ButtonState.Released; } public bool IsLeftMouseButtonUp() { return currentMouseState.LeftButton == ButtonState.Released && previousMouseSate.LeftButton == ButtonState.Released; } public bool IsLeftMouseButtonReleased() { return currentMouseState.LeftButton == ButtonState.Released && previousMouseSate.LeftButton == ButtonState.Pressed; } This is fine. In fact, I kind of like it. However, I'd hate to have to repeat this same code five times (for right, middle, X1, X2). Is there any way to pass in the button I want to the function so I could have something like this? public bool IsMouseButtonDown(MouseButton button) { return currentMouseState.IsPressed(button) && previousMouseState.IsPressed(button); } public bool IsMouseButtonPressed(MouseButton button) { return currentMouseState.IsPressed(button) && !previousMouseState.IsPressed(button); } public bool IsMouseButtonUp(MouseButton button) { return !currentMouseState.IsPressed(button) && previousMouseState.IsPressed(button); } public bool IsMouseButtonReleased(MouseButton button) { return !currentMouseState.IsPressed(button) && previousMouseState.IsPressed(button); } I suppose I could create some custom enumeration and switch through it in each function, but I'd like to first see if there is a built-in solution or a better way.. Thanks!

    Read the article

  • Kohana input & validation libraries - overlap?

    - by keithjgrant
    I'm familiarizing myself with Kohana. I've been reading up on the Input library, which automatically pre-filters GET and POST data for me, and the Validation libary, which helps with form validation. Should I use both together? The examples given in the Validation library documentation use the unfiltered $_POST array instead of $this->input->post(). Seems to me it would be more secure to chain the two, but the two sets of documentation seem to make no mention of each other, so I don't know if this would be redundant or not.

    Read the article

  • Command-line input causes SyntaxError

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in <module> phoneNumber = str(input("Please enter a phone number: ")) File "<string>", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo> By the way, I did import re and tried using rstrip in case of the \n What else could I be missing? Thanks in advance.

    Read the article

  • Redirecting input to another view

    - by Jon
    My application is working fine on the normal iPad display, but I also need to output to VGA out. When I do this, I need to add the view to the external screen's window which seems to mean that I can't use it to accept input from the iPad screen. I want to redirect input from the iPad's window to the window displaying on the external screen. As far as I can tell there's no standard method of doing this. I've tried overriding hitTest on the iPad's window view to send it to the window on the external display, but the coordinates seem to get messed up in the process which makes it nigh unusable. I've also tried subclassing the iPad's UIWindow and catching events in sendEvent, then trying to send them to the external window, but this doesn't seem to work at all. Any help would be appreciated, I'm happy to post any code you would like to see. Thanks, Jon

    Read the article

  • Limiting input to specified regexp with uppercase chars in IE

    - by pixelboy
    I'm trying to limit what our users will be able to type in inputs, using javascript/jquery. Problem is, I have to limit this to Uppercase chars only, and numbers. Here's what I coded previously : $(input).keydown(function(e){ if ($(input).attr("class")=="populationReference"){ var ValidPattern = /^[A-Z_0-9]*$/; var char = String.fromCharCode(e.charCode); if (!ValidPattern.test(char) && e.charCode!=0){ return false; e.preventDefault(); } } }); If Firefox supports charCode, IE doesn't. How then, could I test if the user is typing uppercase or lowercase characters ? Thanks for any help !

    Read the article

  • Why wont my while loop take new input (c++)

    - by Van
    I've written a program to get a string input from a user and parse it into tokens and move a robot according to the input. My problem is trying to issue more than one command. The code looks like: void Navigator::manualDrive() { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; while(true) { Navigator::parseInstruction(uinput); } } /* parseInstruction(char *c) -- parses cstring instructions received * and moves robot accordingly */ void Navigator::parseInstruction(char * c) { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; cout << "Enter your directions below: \n"; cin.ignore(); cin.getline (uinput, bufSize); token=strtok(uinput, delim); if(strcmp("forward", token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); Navigator::travel(inches); } if(strcmp("back",token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); double value = fabs(0.0735 * fabs(inches) - 0.0550); myRobot.backward(1/*speed*/, value/*time*/); } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("left",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnLeft(1/*speed*/, value/*time*/); } } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("right",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnRight(1/*speed*/, value/*time*/); } } if(strcmp("stop",token) == 0) { myRobot.motors(0,0); } } In the function manualDrive I have a while loop calling the function parseInstruction infinitely. The program outputs "Enter your directions below: " When I give the program instructions it executes them, and then it outputs "enter your directions below: " again and when I input my directions again it does not execute them and outputs "Enter your directions below: " instead. I'm sure this is a very simple fix I'm just very new to c++. So if you could please help me out and tell me why the program only takes the first set of directions. thanks

    Read the article

  • How do I design a game framework for fast reaction to user input?

    - by Miro
    I've played some games at cca 30 fps and some of them had low reaction time - cca 0.1sec. I hadn't knew why. Now when I'm designing my framework for crossplatform game, I know why. Probably they've been preparing new frame during rendering the previous. RENDER 1 | RENDER 2 | RENDER 3 | RENDER 4 PREPARE 2 | PREPARE 3 | PREPARE 4 | PREPARE 5 I see first frame when second frame is being rendered and third frame being prepared. If I react in that time to 1st frame it will result in forth frame. So it takes 3/FPS seconds to appear results. In 30 fps it would be 100ms, what is quite bad. So i'm wondering what should I design my framework to response to user interaction quickly?

    Read the article

  • Replace input type=file by an image

    - by nikospkrk
    Hi, Like a lot of people, I'd like to customize the ugly input type=file, and I know that it can't be done without some hacks and/or javascript. But, the thing is that in my case the upload file buttons are just for uploading images (jpeg|jpg|png|gif), so I was wondering if I could use a "clickable" image which would act exactly as an input type file (show the dialog box, and same $_FILE on submitted page). I found some workaround here, and this interesting one too (but does not work on Chrome =/). What do you guys do when you want to add some style to your file buttons? If you have any point of view about it, just hit the answer button ;) Cheers, Nicolas

    Read the article

  • How to Include SVG file as <input> background

    - by eknown
    I'm a newbie to the SVG world, just started experimenting today. I'm trying to create a mobile site where the primary graphics are all scalable, thus supporting all display resolutions. I created an svg file for my input (currently type="image"), and suprisingly the results are as expected in my code editor (Coda). In testing (mobile Safari, DT Safari and DT FF), the input displays broken image path placeholder (the oath is correct because I can right-click to download the file). How do I go about including my SVG file in the (html5) document?

    Read the article

  • Why wont my while loop wont take new input (c++)

    - by Van
    I've written a program to get a string input from a user and parse it into tokens and move a robot according to the input. My problem is trying to issue more than one command. The code looks like: void Navigator::manualDrive() { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; while(true) { Navigator::parseInstruction(uinput); } } /* parseInstruction(char *c) -- parses cstring instructions received * and moves robot accordingly */ void Navigator::parseInstruction(char * c) { const int bufSize = 42; char uinput[bufSize]; char delim[] = " "; char *token; cout << "Enter your directions below: \n"; cin.ignore(); cin.getline (uinput, bufSize); token=strtok(uinput, delim); if(strcmp("forward", token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); Navigator::travel(inches); } if(strcmp("back",token) == 0) { int inches; token = strtok(NULL, delim); inches = atoi (token); double value = fabs(0.0735 * fabs(inches) - 0.0550); myRobot.backward(1/*speed*/, value/*time*/); } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("left",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnLeft(1/*speed*/, value/*time*/); } } if(strcmp("turn",token) == 0) { int degrees; token = strtok(NULL, delim); if(strcmp("right",token) == 0) { token = strtok(uinput, delim); degrees = atoi (token); double value = fabs(0.0041 * degrees - 0.0523); myRobot.turnRight(1/*speed*/, value/*time*/); } } if(strcmp("stop",token) == 0) { myRobot.motors(0,0); } } In the function manualDrive I have a while loop calling the function parseInstruction infinitely. The program outputs "Enter your directions below: " When I give the program instructions it executes them, and then it outputs "enter your directions below: " again and when I input my directions again it does not execute them and outputs "Enter your directions below: " instead. I'm sure this is a very simple fix I'm just very new to c++. So if you could please help me out and tell me why the program only takes the first set of directions. thanks

    Read the article

  • HTML Input on change of value

    - by arik-so
    Hello, I have an input tag. This tag does not have the autocomplete feature turned off, thus, one does not necessarily need to release a key to change the value of this field and focus anotehr one. My question is: how can I detect ANY value changes of this particular field, like e. g. <input onvaluechange="//do following..." /> The JavaScritp attribute onchange does not fire on change of value, only on changes like blur, focus, etc... Thanks in advance!

    Read the article

  • jQuery focus on content of input / textarea - not working properly in IE8

    - by katebp
    I want the input fields on my site to select all the text when the user first clicks on them, but in IE8 the text is selected for a split second then reverts back to normal. Works fine in FF. My js code: $(document).ready(function () { //HTML DOM document is ready // Add this behavior to all text fields $("input[type='text'], textarea").live("focus", function(){ // Select field contents this.focus(); }); }); Any ideas? I've tried adding ".select()" after "this" and bizarrely enough it works, but throws loads of js errors in FF and IE. Thanks

    Read the article

  • jQuery pagination go to page on input value change

    - by JV10
    I'm creating some pagination for my website, and want to use an input-element to navigate between pages. Like the following example: The input would require the "return" key to be hit for the script to trigger. If the value entered is not within range and alert would trigger. e.g. If there was 32 pages, "Please enter a value between 1 and 32" Can this be done using jQuery or javascript, by detecting the value change within the range of pages and redirecting to that page? I'm trying to create the same device on Getty Images: http://www.gettyimages.com.au/Search/Search.aspx?contractUrl=2&language=en-US&family=creative&p=ball&assetType=image&clarification=ball%3A60847

    Read the article

  • set an input value from jquery function

    - by user1499220
    I'm simply trying to set a value for an input but it doesn't work. Here is my jquery function : function display_form() { try { $('#start_date').val('2012/08/21'); }catch (e){ alert('error'); } window.alert( $('[name=start_date]').val() ); } This shows "undefined". Here is my form : <input id="start_date" name="start_date" type="text" size="6" /> Should I put somewhere the id of the form that I want to use? I just followed what is said in the documentation of jquery but it doesn't seem to work. Could anyone help me ?

    Read the article

  • Reading input all together or in steps?

    - by nischayn22
    For many programming quizzes we are given a bunch of input lines and we have to process each input , do some computation and output the result. My question is what is the best way to optimize the runtime of the solution ? Read all input, store it (in array or something) ,compute result for all of them, finally output it all together. or 2. Read one input, compute the result, output the result and so on for each input given.

    Read the article

  • user input question

    - by jdbeverly87
    My program checks to test if a word or phrase is a palindrome (reads the same both backward and forward, ex "racecar"). The issue I'm having is after someone enters in "racecar" getting it to actually test. In the below code, I marked where if I type in "racecar" and run, Java returns the correct answer so I know I'm right there. But what am I missing as far as entering it into the console. I think my code is ok, but maybe I have something missing or in the wrong spot? Not really looking for a new answer unless I'm missing something, but if possible perhaps a pro at this moving my code to the correct area bc I'm stuck! `import java.util.*; public class Palindrome { public static void main(String[] args) { String myInput; Scanner in = new Scanner(System.in); System.out.println("Enter a word or phrase: "); **//this asks user for input but doesn't check for whether or not it is a palindrome** myInput = in.nextLine(); in.close(); System.out.println("You entered: " + myInput); } { String s="racecar"; **//I can type a word here and it works but I need** int i; **//I need it to work where I ask for the input** int n=s.length(); String str=""; for(i=n-1;i>=0;i--) str=str+s.charAt(i); if(str.equals(s)) System.out.println(s+ " is a palindrome"); else System.out.println(s+ " is not a palindrome"); } }` I'm new at programming so I'm hoping what I got is ok. I know the palindrome test works I'm just needing helping having it test thru where I'm entering it into the console. Thanks

    Read the article

  • Long text input from user and PDF generation

    - by Petteri Hietavirta
    I have built a web application that can be seen as an overcomplicated application form. There are bunch of text areas with a given character limit. After the form submission various things happen and one of them is PDF generation. The text is queried from the DB and inserted in the PDF template created in iReports. This works fine but the major pain is overflowing text. The maximum number of characters is set based on 'average' text. But sometimes people prefer to write with CAPS or add plenty of linefeeds to format their text. These then cause user's text to overflow the space given in PDF. Unfortunately the PDF document must look like a real application form so I cannot allow unlimited space. What kind of approaches you have used to tackle this? Clean/restrict user input? Calculate the space requirement of the text based on font metrics? Provide preview of the PDF? (too bad users are not allowed to change their input after submission...)

    Read the article

  • Populating a foreign key table with variable user input

    - by Vincent
    I'm working on a website that will be based on user contributed data, submitted using a regular HTML form. To simplify my question, let's say that there will be two fields in the form: "User Name" and "Country" (this is just an example, not the actual site). There will be two tables in the database : "countries" and "users," with "users.country_id" being a foreign key to the "countries" table (one-to-many). The initial database will be empty. Users from all over the world will submit their names and the countries they live in and eventually the "countries" table will get filled out with all of the country names in the world. Since one country can have several alternative names, input like Chile, Chili, Chilli will generate 3 different records in the countries table, but in fact there is only one country. When I search for records from Chile, Chili and Chilli will not be included. So my question is - what would be the best way to deal with a situation like this, with conditions such that the initial database is empty, no other resources are available and everything is based on user input? How can I organize it in such way that Chile, Chili and Chilli would be treated as one country, with minimum manual interference. What are the best practices when it comes to normalizing user submitted data and is there a scientific term for this? I'm sure this is a common problem. Again, I used country names just to simplify my question, it can be anything that has possible different spellings.

    Read the article

  • Input questions mysql php html

    - by Marcelo
    (Q1)Hi I'm using textbox in my project and I can't receive the values that are typed <textarea rows="5" cols="60"> Type your suggestion </textarea> <br> <input type="submit" name="sugestao" value="Submit" /> Sorry I don't know how to 'kill' html code, that's why < is missing. All I'm getting in the column of the database from this text box is "Submit", I'd like to receive whatever is written in the text area. How can I make the value equal whaterever is typed? (Q2) How can I make sure that I'll only store the same type(int,varchar,text) that I setted,declared in the database. For example: age(int), but if someone types "abc" in the input it will be stored in my database as the value 0 . How can I forbid this, and only save the age when it's just int and all the other fields(like name, email) are filled ?. And if is still possible warn the user that he is typing something wrong, don't need to say where. Sorry for any mistake in English and Thanks for the attention.

    Read the article

  • ASP.NET MVC check form input is valid on submit

    - by Gavin
    Hi all, I have a form that when submitted shows a busy animation and disables the submit button. Anyone know how to query Microsoft's Sys.Mvc.FormValidation to see if the form passed it's test so I can prevent the busy animation showing if the form hasn't actually been submitted? Or even some other work-around? At present my client side javascript looks like this: $('form').submit(function() { $('input[type=submit]', this).attr('disabled', 'disabled'); ShowBusy(); }); Cheers, Gavin

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >