Jump to content

Search the Community

Showing results for tags 'optional'.



More search options

  • 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 2 results

  1. Hi, I need to generate a XSD from XML DataFile. My Data looks like<DOCUMENTS><DOCUMENT><T1>TEST1</T1><T2>TEST2</T2><T3>TEST3</T3><T4>TEST4</T4></DOCUMENT></DOCUMENTS> I am trying to generate a XSD where I don't want to specify about the elements other than T1 and T4.I need only to verify if T1 and T4 exists and the schema validation should fail if any of them does not exist. Because the data file may change tomorrow and I can add a new element <T5></T5> and I don't want to update the XSD. And also the elements can occur in any order. The elements T1 and T4 should occur only once and they are mandatory. I am trying to use <xs:any> attribute, but I am not able to use it along with <xs:choice>.. Any help is apprieciated.
  2. I created a php contact form for our Technology department in a school district. I would like to make a particular field required or optional based on the choice made in a dropdown menu.So, if the user chooses the Hardware or Software category, I want the barcode field to be required. If they choose Username/Password, I want the barcode field to be optional.Here is the part of the code that is validating fields: function died($error) { // your error code can go here echo "<b>We are very sorry, but there were error(s) found with the form you submitted.</b><br /> <br />"; echo $error."<br />"; echo "Please go back and fix these errors.<br />"; die(); } // validation expected data exists if(!isset($_POST['name']) || !isset($_POST['location']) || !isset($_POST['email']) || !isset($_POST['machine']) || !isset($_POST['problem'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $name = $_POST['name']; // required $location = $_POST['location']; // required $email_from = $_POST['email']; // required $machine = $_POST['machine']; // required $barcode = $_POST['barcode']; // not required $problem = $_POST['problem']; // required $issue = $_POST['issue']; $error_message = ""; if(($issue) == '') { $error_message .= 'Please select a category.<br />';} if(($issue) == "Hardware" || "Software" && ($barcode) == '') { $error_message .= 'The Service Tag/Barcode you entered does not appear to be valid.<br />'; } $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z0-9, .'-]+$/"; if(!preg_match($string_exp,$name)) { $error_message .= 'The Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$location)) { $error_message .= 'The Location you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$machine)) { $error_message .= 'The Machine you entered does not appear to be valid.<br />'; } if(strlen($problem) < 2) { $error_message .= 'The problem you entered does not appear to be valid.<br />'; } if(strlen($error_message) >= 1) { died($error_message); } The problem is that this always setting $error_message to 'The Service Tag/Barcode you entered does not appear to be valid.<br />'. So, when user selects Username/Password the error message is still preventing the script from sending the email.Any ideas?Lucas Land
×
×
  • Create New...