Jump to content

Search the Community

Showing results for tags 'validation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 19 results

  1. I want to use preg_replace to input only a-zAZ with a limit of 30 characters I have a piece of code I used before but it works with preg_match. example function: <?php // input form to get the name // use the function here $name = valid_name($name); // function to validate name input function valid_name($data){ $data = ltrim($data); $data = rtrim($data); $data = preg_replace("/^(?:[A-Za-z][A-Za-z\-]{2,30}[A-Za-z]|[A-Za-z])$/", '' , $data); return $data; } ?> To give an impression of how I use it; a part of the confirmation form <html> <form action="mypage.php" method="post"> <p><input type="text" name="name" value="<?php echo $name; ?>" STYLE="background-color: #708DCC; color: white; height: 20px; width: 200px; border: none; font-size: 14px;" readonly ></p> <!-- rest of the form --> </html> The problem is in the preg_replace part. an input with chars like: ^&$ etc is not replaced, how to do this? if anyone can help I would be really happy.
  2. Hi I cannot find a way to validate this code. marked in red error The report I get back is "expected Element p not allowed as child of element h2 in this context" <div class="content-grid"> <a href="single.html" class="b-link-stripe b-animate-go"> <img src="images/pi2.jpg" alt="rose"> <div class="b-wrapper"> <h2 class="b-animate b-from-left b-delay03 "> <span>Cool App Design</span> <p>development, mobile</p> <i> </i> </h2> </div> When I rewrite to; <div class="content-grid"> <a href="single.html" class="b-link-stripe b-animate-go"> <img src="images/pi2.jpg" alt="rose"> <div class="b-wrapper"> <h2 class="b-animate b-from-left b-delay03 "> <span>Cool App Design</span> development, mobile <i> </i> </h2> </div> The above goes through validation when published but just below the 2 lines of text is a short Line you loose this effect on the 2nd script Tried all the tags tried lo li h1 h2 3h and others to try and get it validated with to include the short line below the text. But I am stuck Thank you for your time JohnC
  3. How should I validate 'wrong' or 'fake' protocols? Not sure how to explain this. I mean type mismatches like gttps : // but also random chars like qwerty : // should be validated. So chars before : // ( placed spaces in the protocols above else I wasnt possible to post it here) How to do this with regex php?
  4. Hi there I'm looking for a way to strip multiple backslashes. I'm able to strip up to 7 backslashes. This is my code: $url = stripslashes($url); $url = stripslashes($url); $url = stripslashes($url); You read it well, I used it 3 times. I know the backslash is a delimiter so it is necessary to use it 3 times to strip one slash. But my goal is (like with other characters) to strip all. How is PHP handling this?
  5. I'm looking for a way to block input in a text field occuring more than 5 times. For example aaaaaa is wrong but: A sentence having an input of a happening several times or even more is okay. above sentence has 7 inputs and shouldnt be blocked. What is the solution?
  6. Hello Forum! I have a little problem. What I have is a registration page. I want to validate the input of the user in real time. I use JQuery. $("#inputUsername").change(checkUsername); $("#inputEmail").change(checkEmail); $("#inputPassword").change(checkPassword); $("#inputPasswordConfirm").change(checkPasswordConfirm); I check if something was changed. For example like this: function checkUsername() { $(this).popover({placement:"right", container:'body'}); var username = $(this).val(); if(username == '') { $(this).data('bs.popover').options.content = 'Please enter a username'; $(this).popover("show"); } else if(username.length < 5 || username.length > 20) { $(this).data('bs.popover').options.content = 'Please enter a username with 5-20 characters'; $(this).popover("show"); } else { $(this).popover("destroy"); } } Now when the user submits the form, I thought I could use something like this: $("#registerForm").submit(function( event ) { if(!checkUsername || !checkEmail || !checkPassword || !checkPasswordConfirm) { event.preventDefault(); } }); Obviously the functions don't have return types. But even with it doesn't work. With it doesn't work I mean that submit event isn't ignored even if there are errors in the form. I might be doing something wrong with JavaScript as I'm not used to it! Before someone suggests a plugin, I don't have enough control with them. Thanks!
  7. Can someone give an example of a php script that lets a form with checkbox input choose between 2 different pages when it is checked or not. Actually the dilemma is that the action attribute is sending form data to another pages (2 pages) - but dont know what code to use - . So if the checkbox isnt checked a third page should load in the browser.
  8. Hi, I have a details screen where visitors to the website can leave their contact info. I have some javascript rules to validate some of the fields when the visitor is filling them out so they cannot leave certain fields empty. I have an email field where aswell as stopping the visitor leaving the field blank i want a validation check so it looks for the presence of "@" and a "." within the field. But I am having trouble getting this implemented. Currently my code for the blank checks looks like this (with the email field in the last block) :- </script><script language="javascript" type="text/javascript">function validate_form ( ){valid = true; if (document.networkOpportunity.contactName.value == "") { alert ( "Please enter the name of the contact for the opportunity." ); document.networkOpportunity.contactName.focus(); document.networkOpportunity.contactName.style.backgroundColor = "#d7edf8"; valid = false; } else if (document.networkOpportunity.companyName.value == "") { alert ( "Please enter the company name that the opportunity is for." ); document.networkOpportunity.contactName.style.backgroundColor = "#FFFFFF"; document.networkOpportunity.companyName.focus(); document.networkOpportunity.companyName.style.backgroundColor = "#d7edf8"; valid = false; } else if (document.networkOpportunity.serviceRequired.value == "") { alert ( "Please enter the details of the service you require." ); document.networkOpportunity.companyName.style.backgroundColor = "#FFFFFF"; document.networkOpportunity.serviceRequired.focus(); document.networkOpportunity.serviceRequired.style.backgroundColor = "#d7edf8"; valid = false; } else if (document.networkOpportunity.contactEmail.value == "") { alert ( "Please enter the email we can contact you on." ); document.networkOpportunity.serviceRequired.style.backgroundColor = "#FFFFFF"; document.networkOpportunity.contactEmail.focus(); document.networkOpportunity.contactEmail.style.backgroundColor = "#d7edf8"; valid = false; } Any help with how to add the extra validation on the contactEmail field to look for "@" and "." will be greatly appreciated.
  9. Hi all, I noticed while deciding to randomly validate sites (As you do...?) the Colour Picker png is missing an ALT tag @ http://www.w3schools.com/ as @ 1am 29/04/2015 NZST. Line 807, Column 101: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.…ef_colorpicker.asp"><img class="colorpicker" src="/images/colorpicker.png"></a>
  10. I was wondering if someone could help me. We were learning some basic javascript in class and I can't seem to get my form to validate. Basically all I wanted it to do is return an error when nothing is entered in the field. I've done it the way we were taught in class via examples. Any help would be much appreciated!! index.html
  11. Hi guys! I've been working on a login form and I have some problems to validate the input data, I need to consist if the login and password fields aren't with spaces or no allowed characters, for this I've been used JavaScript for client-side validation, but if the fields are Ok, I need to call my php function to see if the user and pass are on mySQL database. I don't know how to "call" the php after the JavaScript validation. If someone could help me I will be thankful.
  12. I have been trying to find a solution to my problem is the last 10 days, and I found nothing. So, I am trying to restrict the Authentication Context XML Schema Definition of SAML 2.0. The XSD document is accessible at http://docs.oasis-open.org/security/saml/v2.0/saml-schema-authn-context-types-2.0.xsd. The part that I am trying to restrict is the one related to this part of the XSD document: <xs:complexType name="PasswordType"> <xs:sequence> <xs:element ref="Length" minOccurs="0"/> <xs:element ref="Alphabet" minOccurs="0"/> <xs:element ref="Generation" minOccurs="0"/> <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="ExternalVerification" type="xs:anyURI" use="optional"/></xs:complexType><xs:element name="RestrictedPassword" type="RestrictedPasswordType"/><xs:complexType name="RestrictedPasswordType"> <xs:complexContent> <xs:restriction base="PasswordType"> <xs:sequence> <xs:element name="Length" type="RestrictedLengthType" minOccurs="1"/> <xs:element ref="Generation" minOccurs="0"/> <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="ExternalVerification" type="xs:anyURI" use="optional"/> </xs:restriction> </xs:complexContent></xs:complexType> Well, I do not know how to restrict the RestrictedPassword complex Type. Below is my XSD, that tries to restrict the original XSD document. <?xml version="1.0" encoding="UTF-8"?><xs:schema version="2.0" targetNamespace="urn:m:SAML:2.0:ac:classes:K" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:m:SAML:2.0:ac:classes:K" finalDefault="extension" blockDefault="substitution"> <xs:redefine schemaLocation="http://docs.oasis-open.org/security/saml/v2.0/saml-schema-authn-context-types-2.0.xsd"> <xs:complexType name="RestrictedPasswordType"> <xs:complexContent> <xs:restriction base="RestrictedPasswordType"> <xs:sequence> <xs:element ref="Length" minOccurs="0"/> <xs:element ref="Generation"/> <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="ExternalVerification" type="xs:anyURI" use="optional"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:redefine> </xs:schema> When I try to validate this XSD in this tool http://www.utilities-online.info/xsdvalidation/#.UwJAzK69h31 it returns me an error, that I do not know how to fix. Any help is welcome. Thanks! Domenech, Marlon
  13. [size=3][font=arial, helvetica, sans-serif]Hello,[/font][/size] [size=3][font=arial, helvetica, sans-serif]When validating W3C XHTML 1.0 Transitional I keep getting the error there is no attribute "srcset".[/font][/size][size=3][font=arial, helvetica, sans-serif]The code looks similar to the one on [url="http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/"]http://www.w3.org/ht...set/w3c-srcset/[/url], but it still doesn't work.[/font][/size] [size=3][font=arial, helvetica, sans-serif]<div class="imageself self" style="width:468px;height:121px;">[/font][/size][size=3][font=arial, helvetica, sans-serif]<img width="468" height="121" id="image-1111C3BE-A814-4536-B78D-5AE9BCA3AA66" class="mobile-shrunk" src="http://www.xxx.be/onewebstatic/3303f82ae3-DeBedenkerij_logo_white_hires.jpg" srcset="http://www.xxx.be/onewebstatic/3303f82ae3-DeBedenkerij_logo_white_hires.jpg 570w, http://www....white_hires.jpg 1x" style="display:block;" title="" alt="De Bedenkerij" /> </div>[/font][/size] [size=3][font=arial, helvetica, sans-serif]Thanks for any tips :-)[/font][/size]
  14. Hello people, I'm a new member here and this is my first post. I have a form with 3 fields (UserID, UserFirstname, UserSurname). I want a jquery validation script that would check if the UserID entered is in the database. If TRUE it should echo "Valid UserID" and If FALSE it should echo "Invalid UserID" I have the following codes but it seems not to be executing the PHP File. ///Sign Up Form<div id="form"><form method="post" action="validate.php" id="formID"> <table width="351" height="155" border="0"> <tr> <td width="103">Sign Up Level<span class="styledmenu"></span></td> <td width="238"><label for="textfield"></label> <label for="level"></label> <select name="level" id="level"> <option value="Enrollee">Enrollee</option> <option value="Provider">Provider</option> </select></td> </tr> <tr> <td>CIL Number ?</td> <td><input type="text" class="validate[required,custom[onlyLetterNumber],maxSize[20],ajax[ajaxUserCallPhp]] text-input" name="cil" id="cil" /></td> </tr> <tr> <td>Surname:</td> <td><input type="text" class="validate[required,custom[onlyLetterSp],maxSize[20],ajax[ajaxNameCallPhp]] text-input" name="sname" id="sname" /></td> </tr> <tr> <td>Fullname:</td> <td><input type="text" class="validate[required,custom[onlyLetterSp],maxSize[20],ajax[ajaxNameCallPhp]] text-input" name="fname" id="fname" /></td> </tr> <tr> <td> </td> <td><input type="submit" name="signup" id="signup" value="Sign Up" /></td> </tr> </table> </form> </div> ///Validate.php <?phprequire_once('../Connections/connection.php');//include('popupform.php');//create our own array like this$field = $_GET['fieldId'];$value = $_GET['fieldValue']; //this will contain the value in the textbox$data[$field] = $value; if(isset($_POST['cil'])){ $val = mysql_real_escape_string($_POST['cil']);//validate if value is in the database$check_sql = "SELECT * FROM enrollees WHERE cid='$val'";$check_query = mysql_query($check_sql);$row_check = mysql_fetch_assoc($check_sql);$check_num = mysql_num_rows($check_query); if($check_num == 1){$rtn = true;}else{$rtn = false;}}//convert to json//header('Content-Type: text/json');echo json_encode($rtn);?> ///JQUERY (function($){ $.fn.validationEngineLanguage = function(){ }; $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* This field is required", "alertTextCheckboxMultiple": "* Please select an option", "alertTextCheckboxe": "* This checkbox is required" }, "minSize": { "regex": "none", "alertText": "* Minimum ", "alertText2": " characters allowed" }, "maxSize": { "regex": "none", "alertText": "* Maximum ", "alertText2": " characters allowed" }, "min": { "regex": "none", "alertText": "* Minimum value is " }, "max": { "regex": "none", "alertText": "* Maximum value is " }, "past": { "regex": "none", "alertText": "* Date prior to " }, "future": { "regex": "none", "alertText": "* Date past " }, "maxCheckbox": { "regex": "none", "alertText": "* Checks allowed Exceeded" }, "minCheckbox": { "regex": "none", "alertText": "* Please select ", "alertText2": " options" }, "equals": { "regex": "none", "alertText": "* Fields do not match" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alertText": "* Invalid phone number" }, "email": { // Simplified, was not working in the Iphone browser "regex": /^([A-Za-z0-9_\-\.\'])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/, "alertText": "* Invalid email address" }, "integer": { "regex": /^[\-\+]?\d+$/, "alertText": "* Not a valid integer" }, "number": { // Number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/, "alertText": "* Invalid floating decimal number" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, "alertText": "* Invalid date, must be in YYYY-MM-DD format" }, "ipv4": { "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, "alertText": "* Invalid IP address" }, "url": { "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, "alertText": "* Invalid URL" }, "onlyNumberSp": { "regex": /^[0-9\ ]+$/, "alertText": "* Numbers only" }, "onlyLetterSp": { "regex": /^[a-zA-Z\ \']+$/, "alertText": "* Letters only" }, "onlyLetterNumber": { "regex": /^[0-9a-zA-Z\ \/]+$/, "alertText": "* No special characters allowed" }, // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings "ajaxUserCall": { "url": "signup.php", // you may want to pass extra data on the ajax call "alertTextOk": "* Correct CIL", "alertText": "* This user is already taken", "alertTextLoad": "* Validating CIL, please wait" }, "ajaxUserCallPhp": { "url": "signup.php", // you may want to pass extra data on the ajax call // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* Correct CIL", "alertText": "* Invalid CIL", "alertTextLoad": "* Validating CIL, please wait" }, "ajaxNameCall": { // remote json service location "url": "ajaxValidateFieldName", // error "alertText": "* This name is already taken", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* This name is available", // speaks by itself "alertTextLoad": "* Validating, please wait" }, "ajaxNameCallPhp": { // remote json service location "url": "signup.php", // error "alertText": "* This name is already taken", // speaks by itself "alertTextLoad": "* Validating Name, please wait" }, "validate2fields": { "alertText": "* Please input HELLO" } }; } }; $.validationEngineLanguage.newLang();})(jQuery); Anyone There spotting the problem please let me know.
  15. Hello there, I am new to these forums and I am hoping I can get a lot of help from here Basically i've looked through the W3C markup validation service to see if there any errors in my CSS coding because my site isnt looking right in IE. What i've found is that all the errors arn't actually errors? Please if anyone could click the link below and tell me what the supposed errors are? http://validator.w3....=Inline&group=0 The site: http://mandownclothing.com/ Thank you in advanced! Kieran P.S I have attached an example image.
  16. Trying to get a site, page by page validated. <script src="http://www.apple.com/library/quicktime/scripts/ac_quicktime.js" language="JavaScript" type="text/javascript"></script>'The language attribute on the script element is obsolete. You can safely omit it.' Everything on the site will function without the use of these scripts? I currently have 4 scripts between the head tags, and unclear as to why i wouldn't need them? Also, it says this error message for all of ym <h> tags. Where else do they go??Element h7 not allowed as child of element div in this context. (Suppressing further errors from this subtree.) <h7>FILM</h7> Appreciate any help.
  17. My website is getting closer to being completed but it does not validate and with over 278 errors, its annoying (im so tired now lol) Can someone look at the errors on the attached file and let me know what I need to do to correct it. (Its not the one with 278 errors as it says its too large so I uploaded the smaller page) ride-out-gallery.html
  18. I was looking through some ways to validate email. I saw the one on w3schools, but that is a basic one, so I started to code something more complicated adding all those if, else if, else statements, etc. Then I came across this... function validateEmail(email){var allowed=/^([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$)/; return allowed.test(email);} Is something that simple sufficient enough? Everything seems to look as if it would work. Also, what does the "$" do?
  19. just noticed that some code I was having trouble with ended up not validating. http://www.w3schools...put_type_hidden this is some sample code to showcase the hidden input types If you put in this code <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <form action="form_action.asp" method="get"> Email: <input type="text" name="email" /><br /> <input type="hidden" name="country" value="Norway" /> <input type="submit" value="Submit" /> </form> <p>Click on the submit button, and the input will be sent to a page on the server called "form_action.asp".</p> </body> </html> you end up with errors like this Line 6, Column 3: character data is not allowed here Email: <input type="text" name="email" /><br /> ? You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include: putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML. and a few of these Line 6, Column 43: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag Email: <input type="text" name="email" /><br /> ? The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>"). a few more errors that might be due to the hasty page I created but things like the first bit really don't validate when you use them in a real context and teh second one. I've been able to get them to work if you wrap them in a span or div. Someone was telling me that input can't be a direct child element of form but has to have a block level element above it.
×
×
  • Create New...