Search Results

Search found 23207 results on 929 pages for 'node form'.

Page 17/929 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • php form submit and the resend infromation screen

    - by Para
    Hello, I want to ask a best practice question. Suppose I have a form in php with 3 fields say name, email and comment. I submit the form via POST. In PHP I try and insert the date into the database. Suppose the insertion fails. I should now show the user an error and display the form filled in with the data he previously inserted so he can correct his error. Showing the form in it's initial state won't do. So I display the form and the 3 fields are now filled in from PHP with echo or such. Now if I click refresh I get a message saying "Are you sure you want to resend information?". OK. Suppose after I insert the data I don't carry on but I redirect to the same page but with the necessary parameters in the query string. This makes the message go away but I have to carry 3 parameters in the query string. So my question is: How is it better to do this? I want to not carry around lots of parameters in the query string but also not get that error. How can this be done? Should I use cookies to store the form information.

    Read the article

  • Zend Framework Form Element Validators - validate a field even if not required

    - by Jeremy Hicks
    Is there a way to get a validator to fire even if the form element isn't required? I have a form where I want to validate the contents of a texbox (make sure not empty) if the value of another form element, which is a couple of radio buttons, has a specific value selected. Right now I'm doing this by overriding the isValid() function of my form class and it works great. However, I'd like to move this to either its on validator or use the Callback validator. Here's what I have so far, but it never seems to get called unless I change the field to setRequired(true) which I don't want to do at all times, only if the value of the other form element is set to a specific value. // In my form class's init function $budget = new Zend_Form_Element_Radio('budget'); $budget->setLabel('Budget') ->setRequired(true) ->setMultiOptions($options); $budgetAmount = new Zend_Form_Element_Text('budget_amount'); $budgetAmount->setLabel('Budget Amount') ->setRequired(false) ->addFilter('StringTrim') ->addValidator(new App_Validate_BudgetAmount()); //Here is my custom validator (incomplete) but just testing to see if it even gets called. class App_Validate_BudgetAmount extends Zend_Validate_Abstract { const STRING_EMPTY = 'stringEmpty'; protected $_messageTemplates = array( self::STRING_EMPTY => 'please provide a budget amount' ); public function isValid($value) { echo 'validating...'; var_dump($value); return true; } }

    Read the article

  • How can I theme custom form(drupal 6.x)

    - by Andrew
    DRUPAL 6.X I have this custom form constructor inside my custom module which is invoke through ajax request. I’m attempting to theme this form with the template file reside in my theme directory. For that matter, I’ve registered my theme inside template.php file which reside in my theme folder. Here’s how this file looks – function my_theme() { return array( 'searchdb' => array( 'arguments' => array('form' => NULL), 'template' => 'searchform', ) ); } And the following is the excerpt of module code – function test_menu() { $my_form['searchdb'] = array( 'title' => 'Search db', 'page callback' => 'get_form', 'page arguments' => array(0), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $my_form; } function get_form($formtype){ switch($formtype){ case 'searchdb' : echo drupal_get_form('searchdb'); break; } } function searchdb(){ $form['customer_name'] = array( '#type' => 'textfield', '#title' => t('Customer Name'), '#size' => 50, '#attributes' => array('class' => 'name-textbox'), ); return $form; } As you can imagine, this is not working at all. Just to test if my theme is even registered, I’ve also tested with theme function but, it’s not called. I've checked template file name and form-id(through the outputted html source) and everything seems ok. I would be glad if anyone could point me to the right direction.

    Read the article

  • Symfony form values missing

    - by Cav
    Hi, I was writing a simple login form, everything works fine (validation etc.) but I can't get the values, there's my code: public function executeIndex(sfWebRequest $request) { $this->getUser()->clearCredentials(); $this->getUser()->setAuthenticated(false); $this->form = new LoginForm(); if ($request->isMethod('post') && $request->hasParameter('login')) { $this->form->bind($request->getParameter('login')); if ($this->form->isValid()) { $this->getUser()->setAuthenticated(true); $this->getUser()->addCredential('user'); $this->login = $this->form->getValue('login'); } } } $this-login is NULL. Now I checked almost everything, the form is valid, isBound() is true, count() returns 3, I can see the values in my request: parameterHolder: action: index login: { login: foo, password: foo, _csrf_token: 53ebddee1883d7e3d6575d6fb1707a15 } module: login BUT getValues() returns NULL, getValue('login') etc. returns NULL as well. How can it be? And no, I don't want to use sfGuard-Plugins ;)

    Read the article

  • Passing HTML form data in the URL on local machine (file://)

    - by atzz
    Hi, I'm building a small HTML/JS application for primary use on local machine (i.e. everything is accessed via file:// protocol, though maybe in the future it will be hosted on a server within intranet). I'm trying to make a form with method="get" and action="target.html", in the hope that the browser will put form data in the URL (like, file://<path>/target.html?param1=aaa&param2=bbb). However, it's not happening (target.html opens fine, but no parameters is passed). What am I doing wrong? Is it possible to use forms over file:// at all? I can always build the url manually (via JS), but being lazy I'd prefer the browser do it for me. ;) Here is my sample form: <form name='config' action="test_form.html" method="get" enctype="application/x-www-form-urlencoded"> <input type="text" name="param1"> <input type="text" name="param2"> <input type="submit" value="Go"> </form>

    Read the article

  • C++ linked list based tree structure. Sanely copy nodes between lists.

    - by krunk
    edit Clafification: The intention is not to remove the node from the original list. But to create an identical node (data and children wise) to the original and insert that into the new list. In other words, a "move" does not imply a "remove" from the original. endedit The requirements: Each Node in the list must contain a reference to its previous sibling Each Node in the list must contain a reference to its next sibling Each Node may have a list of child nodes Each child Node must have a reference to its parent node Basically what we have is a tree structure of arbitrary depth and length. Something like: -root(NULL) --Node1 ----ChildNode1 ------ChildOfChild --------AnotherChild ----ChildNode2 --Node2 ----ChildNode1 ------ChildOfChild ----ChildNode2 ------ChildOfChild --Node3 ----ChildNode1 ----ChildNode2 Given any individual node, you need to be able to either traverse its siblings. the children, or up the tree to the root node. A Node ends up looking something like this: class Node { Node* previoius; Node* next; Node* child; Node* parent; } I have a container class that stores these and provides STL iterators. It performs your typical linked list accessors. So insertAfter looks like: void insertAfter(Node* after, Node* newNode) { Node* next = after->next; after->next = newNode; newNode->previous = after; next->previous = newNode; newNode->next = next; newNode->parent = after->parent; } That's the setup, now for the question. How would one move a node (and its children etc) to another list without leaving the previous list dangling? For example, if Node* myNode exists in ListOne and I want to append it to listTwo. Using pointers, listOne is left with a hole in its list since the next and previous pointers are changed. One solution is pass by value of the appended Node. So our insertAfter method would become: void insertAfter(Node* after, Node newNode); This seems like an awkward syntax. Another option is doing the copying internally, so you'd have: void insertAfter(Node* after, const Node* newNode) { Node *new_node = new Node(*newNode); Node* next = after->next; after->next = new_node; new_node->previous = after; next->previous = new_node; new_node->next = next; new_node->parent = after->parent; } Finally, you might create a moveNode method for moving and prevent raw insertion or appending of a node that already has been assigned siblings and parents. // default pointer value is 0 in constructor and a operator bool(..) // is defined for the Node bool isInList(const Node* node) const { return (node->previous || node->next || node->parent); } // then in insertAfter and friends if(isInList(newNode) // throw some error and bail I thought I'd toss this out there and see what folks came up with.

    Read the article

  • PHP form auto response

    - by Mark
    Hi, I am using the following php code which has been given to me, it works fine, apart from the auto response bit. I know its not a lot of code I just dont know how to do it or why it snot working. Any help would be appreciated. thanks in advance. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title> - Contact Us</title> <!-- css --> <link rel="stylesheet" type="text/css" href="css/reset.css" /> <link rel="stylesheet" type="text/css" href="css/styles.css" /> <link rel="stylesheet" type="text/css" href="css/colorbox.css" /> <!-- javascript libraries --> <?php require_once('includes/js.php'); ?> </head> <body> <?php //FIll out the settings below before using this script $your_email = "(email address)"; $website = "(website name)"; //BOTS TO BLOCK $bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer|T8Abot|Syntryx|WinHttp|WebBandit|nicebot)/i"; //Check if known bot is visiting if (preg_match($bots, $_SERVER["HTTP_USER_AGENT"])) { exit ("Sorry bots are not allowed here!"); } //Known Exploits $exploits = "/(content-type|bcc:|cc:|from:|reply-to:|javascript|onclick|onload)/i"; //Spam words $spam_words = "/(viagra|poker|blackjack|porn|sex)/i"; // BAD WORDS $words = "/( bitch|dick|pussy|pussies|ass|fuck|cum|cumshot|cum shot| gangbang|gang bang|god dammit|goddammit|viagra|anus|analsex )/i"; //BAD WORD/SPAM WORD/EXPLOIT BLOCKER function wordBlock($word) { //Make variables global global $words; global $exploits; global $spam_words; if (preg_match($words, $word)) { $word = preg_replace($words, "#####", $word); } if(preg_match($exploits,$word)){ $word = preg_replace($exploits,"",$word); } if(preg_match($spam_words,$word)){ $word = preg_replace($spam_words,"$$$$",$word); } return $word; } //CLean data function function dataClean($data) { $data = stripslashes(trim(rawurldecode(strip_tags($data)))); return $data; } //CREATE MAIN VARIABLES $name = (isset ($_POST['name'])) ? dataClean($_POST['name']) : FALSE; $company = (isset ($_POST['company'])) ? dataClean($_POST['company']) : FALSE; $address = (isset ($_POST['address'])) ? dataClean($_POST['address']) : FALSE; $postcode = (isset ($_POST['postcode'])) ? dataClean($_POST['postcode']) : FALSE; $phone = (isset ($_POST['phone'])) ? dataClean($_POST['phone']) : FALSE; $email = (isset ($_POST['email'])) ? dataClean($_POST['email']) : FALSE; $comment = (isset ($_POST['message'])) ? wordBlock(dataClean($_POST['message'])) : FALSE; $submit = (isset ($_POST['send'])) ? TRUE : FALSE; $email_check = "/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i"; //$ip = $_SERVER["REMOTE_ADDR"]; $errors = array(); //Check if send button was clicked if ($submit) { if (!$name) { $errors[] = "Please enter a name!"; } if ($name) { if (!ereg("^[A-Za-z' -]*$", $name)) { $errors[] = "You may not use special characters in the name field!"; } } if (!$email) { $errors[] = "Please enter an email address!"; } if ($email) { if (!preg_match($email_check, $email)) { $errors[] = "The E-mail you entered is invalid!"; } } /* if (!$subject) { $errors[] = "Please enter an email subject!"; } */ if (!$comment) { $errors[] = "Please don't leave the message field blank!"; } //Check if any errors are present if (count($errors) > 0) { foreach ($errors AS $error) { print "&bull; $error <br />"; } } else { //MESSAGE TO SEND TO ADMIN //Create main headers $headers = "From: " . $website . " <$your_email> \n"; $headers .= "Reply-to:" . $email . " \n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-Type: text/html; charset=UTF-8\n"; $message = ""; $message .= "<h1>New E-Mail From " . $website . "</h1><br /><br />"; $message .= "<b>Name:</b> " . $name . "<br />"; $message .= "<b>Company:</b> " . $company . "<br />"; $message .= "<b>Address:</b> " . $address . "<br />"; $message .= "<b>Postcode:</b > " . $postcode . "<br />"; $message .= "<b>Phone No:</b> " . $phone . "<br />"; $message .= "<b>E-mail:</b> " . $email . "<br />"; $message .= "<b>Message:</b> " . $comment . "<br />"; //E-mails subject $mail_subject = "Message from " . $website . ""; /* CHECK TO BE SURE FIRST E-MAIL TO ADMIN IS A SUCCESS AND SEND EMAIL TO ADMIN OTHERWISE DON'T SEND AUTO RESPONCE */ if (mail($your_email, $mail_subject, $message, $headers)) { //UNSET ALL VARIABLES unset ($name, $email, $company, $address, $postcode, $phone, $comment, $_REQUEST); //JAVASCRIPT SUCCESS MESSAGE echo " <script type='text/javascript' language='JavaScript'> alert('Your message has been sent'); </script> "; //SUCCESS MESSAGE TO SHOW IF JAVASCRIPT IS DISABLED echo "<noscript><p>THANK YOU YOUR MESSAGE HAS BEEN SENT</p></noscript>"; /* -----------------END MAIL BLOCK FOR SENDING TO ADMIN AND START AUTO RESPONCE SEND----------------- */ //AUTO RESPONCE MESSAGE //Create main headers $headers = "From: " . $website . " <$your_email> \n"; $headers .= "Reply-to:" . $your_email . " \n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Transfer-Encoding: 8bit\n"; $headers .= "Content-Type: text/html; charset=UTF-8\n"; $message = ""; $message .= "<h1>Thank You For Contacting Us </h1><br /><br />"; $message .= "On behalf of <b>" . $website . "</b> we wanna thank you for contacting us and to let you know we will respond to your message as soon as possible thank you again."; //E-mails subject $mail_subject = "Thank you for contacting " . $website . ""; //Send the email mail($email, $mail_subject, $message, $headers); /* -----------------END MAIL BLOCK FOR SENDING AUTO RESPONCE ----------------- */ } else { echo " <script type='text/javascript' language='JavaScript'> alert('Sorry could not send your message'); </script> "; echo "<noscript><p style='color:red;'>SORRY COULD NOT SEND YOUR MESSAGE</p></noscript>"; } } } ?> <div id="wrapper"> <div id="grad_overlay"> <!-- Header --> <div id="header"> <a href="index.php" title="Regal Balustrades"><img src="images/regal_logo.png" alt="Regal Balustrades" /></a> <div id="strapline"> <img src="images/strapline.png" alt="Architectural metalwork systems" /> </div> </div> <!-- Navigation --> <div id="nav"> <?php require_once('includes/nav.php'); ?> </div> <!-- Content --> <div id="content"> <div id="details"> <p class="getintouch env">Get In Touch</p> <ul class="details"> <li>T. (0117) 935 3888</li> <li>F. (0117) 967 7333</li> <li>E. <a href="mailto:[email protected]" title="Contact via email">[email protected]</a></li> </ul> <p class="whereto hse">Where To Find Us</p> <ul class="details"> <li>Regal Balustrades</li> <li>Regal House, </li> <li>Honey Hill Road,</li> <li>Kingswood, </li> <li>Bristol BS15 4HG</li> </ul> </div> <div id="contact"> <h1>Contact us</h1> <p>Please use this form to request further information about Regal Balustrades and our services. To speak to a member of our staff in person, please call us on 0117 9353888</p> <div id="form"> <form method='POST' action='<?php echo "".$_SERVER['PHP_SELF'].""; ?>'> <p class='form-element'> <label for='name'>Name:</label> <input type='text' name='name' value='<?php echo "" . $_REQUEST['name'] . "";?>' /> </p> <p class='form-element'> <label for='company'>Company:</label> <input type='text' name='company' value='<?php echo "" . $_REQUEST['company'] . "";?>' /> </p> <p class='form-element'> <label for='address'>Address:</label> <textarea name='address' rows='5' id='address' class='address' ><?php echo "" . $_REQUEST['address'] . "";?></textarea> </p> <p class='form-element'> <label for='postcode'>Postcode:</label> <input type='text' name='postcode' value='<?php echo "" . $_REQUEST['postcode'] . "";?>' /> </p> <p class='form-element'> <label for='phone'>Telephone:</label> <input type='text' name='phone' value='<?php echo "" . $_REQUEST['phone'] . "";?>' /> </p> <p class='form-element'> <label for='email'>Email:</label> <input type='text' name='email' value='<?php echo "" . $_REQUEST['email'] . "";?>' /> </p> </div> <div id='form-right'> <p class='form-element'> <label for='message'>Enquiry:</label> <textarea name='message' class='enquiry' id='enquiry' rows='5' cols='40' ><?php echo "" . $_REQUEST['message'] . "";?></textarea> </p> <p class='form-element'> <input type='submit' class='submit' name='send' value='Send message' /> </p> </div> <p class='nb'><em>We will respond as soon as possible.</em></p> </form> </div> </div> </div> </div> </div> <!-- Footer --> <div id="footer-container"> <?php require_once('includes/footer.php'); ?> </div> <!-- js functions --> <script> $(document).ready(function() { $("ul#navig li:nth-child(6)").addClass("navon"); }); </script> </body> </html>

    Read the article

  • Does it matter the direction of a Huffman's tree child node?

    - by Omega
    So, I'm on my quest about creating a Java implementation of Huffman's algorithm for compressing/decompressing files (as you might know, ever since Why create a Huffman tree per character instead of a Node?) for a school assignment. I now have a better understanding of how is this thing supposed to work. Wikipedia has a great-looking algorithm here that seemed to make my life way easier. Taken from http://en.wikipedia.org/wiki/Huffman_coding: Create a leaf node for each symbol and add it to the priority queue. While there is more than one node in the queue: Remove the two nodes of highest priority (lowest probability) from the queue Create a new internal node with these two nodes as children and with probability equal to the sum of the two nodes' probabilities. Add the new node to the queue. The remaining node is the root node and the tree is complete. It looks simple and great. However, it left me wondering: when I "merge" two nodes (make them children of a new internal node), does it even matter what direction (left or right) will each node be afterwards? I still don't fully understand Huffman coding, and I'm not very sure if there is a criteria used to tell whether a node should go to the right or to the left. I assumed that, perhaps the highest-frequency node would go to the right, but I've seen some Huffman trees in the web that don't seem to follow such criteria. For instance, Wikipedia's example image http://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Huffman_tree_2.svg/625px-Huffman_tree_2.svg.png seems to put the highest ones to the right. But other images like this one http://thalia.spec.gmu.edu/~pparis/classes/notes_101/img25.gif has them all to the left. However, they're never mixed up in the same image (some to the right and others to the left). So, does it matter? Why?

    Read the article

  • Set default form textfield value (webbrowser control/DOM Javscript)

    - by Khou
    Hi I would like my application to load a webpage and set default the form textfield value a predefine value. Requirements: -The application is a windows form, it is to use the web browser control, to load a web page. -Textfield values are define by within the application. -When textfield on the webpage matches the applications predefined elements, the predefine fixed value is set and can not be changed by the end user. Example If my application defines element "FirstName" equal to value "John", the text field for value for element "FirstName" will always equal "John" and this value can not be changed by the end user. Below is html/javascript code to perform this functionality, now how do I implement this in a windows form? (without having to modify the loaded webpage source code (if possible). HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>page title</title> <script script type="text/javascript" src="demo1.js"></script> </head> <body onload="def(document.someform, 'name', 'my default name value');"> <h2 style="color: #8e9182">test form title</h2> <form name="someform" id="someform_frm" action="#"> <table cellspacing="1"> <tr><td><label for="name">NameX: </label></td><td><input type="text" size="30" maxlength="155" name="name" onchange="def(document.someform, 'name', 'my default name value');"></td></tr> <tr><td><label for="name2">NameY: </label></td><td><input type="text" size="30" maxlength="155" name="name2"></td></tr> <tr><td colspan="2"><input type="button" name="submit" value="Submit" onclick="showFormData(this.form);" ></td></table> </form> </body> </html> JAVASCRIPT function def(oForm, element_name, def_txt) { oForm.elements[element_name].value = def_txt; }

    Read the article

  • Set default form textfield value (webbrowser control)

    - by Khou
    Hi I would like my application to load a webpage and set default the form textfield value a predefine value. Requirements: -The application is a windows form, it is to use the web browser control, to load a web page. -Textfield values are define by within the application. -When textfield on the webpage matches the applications predefined elements, the predefine fixed value is set and can not be changed by the end user. Example If my application defines element "FirstName" equal to value "John", the text field for value for element "FirstName" will always equal "John" and this value can not be changed by the end user. Below is html/javascript code to perform this functionality, now how do I implement this in a windows form? (without having to modify the loaded webpage source code (if possible). HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>page title</title> <script script type="text/javascript" src="demo1.js"></script> </head> <body onload="def(document.someform, 'name', 'my default name value');"> <h2 style="color: #8e9182">test form title</h2> <form name="someform" id="someform_frm" action="#"> <table cellspacing="1"> <tr><td><label for="name">NameX: </label></td><td><input type="text" size="30" maxlength="155" name="name" onchange="def(document.someform, 'name', 'my default name value');"></td></tr> <tr><td><label for="name2">NameY: </label></td><td><input type="text" size="30" maxlength="155" name="name2"></td></tr> <tr><td colspan="2"><input type="button" name="submit" value="Submit" onclick="showFormData(this.form);" ></td></table> </form> </body> </html> JAVASCRIPT function def(oForm, element_name, def_txt) { oForm.elements[element_name].value = def_txt; }

    Read the article

  • Dynamically adding values to a form with JQuery/Javascript

    - by bigstylee
    I am creating a private message system to allow users to communicate between one another within the context of the website (ie, not emails). I have created this function to handle all my form submissions. I would like to achieve a solution without modifying this function (ideally). $("form.reload").submit(function(){ alert($(this).serialize()); /* Debugging */ $.post($(this).attr("action"), $(this).serialize() ,function(data){ if(data){ $("#error").html(data); }else{ location.reload(); }; }); return false; }); Within my form I am using JQuery Autocomplete to find usernames. This function works perfectly. My first solution was to add buttons within the form with the necessary values. select: function(event, ui) { $("#message_to").append("<input type=\"button\" class=\"recipient\" name=\"recipients[]\" value=\"" + ui.item.label + "\" onclick=\"$(this).remove()\" />"); } <form method="post" action="/messages-create"> <div id="message_to"></div> </div> For some reason the values of recipients are not getting posted. My second solution was to add to a post array that already existed in the form select: function(event, ui) { $(input[name=recipeients[]).val = ui.item.label; /* Need to add to array, not replace! */ $("#message_to").append("<input type=\"button\" class=\"recipient\" name=\"recipient\" value=\"" + ui.item.label + "\" onclick=\"$(this).remove(); /* Remove from recipients */\" />"); } <form method="post" action="/messages-create" class="reload"> <input type="hidden" name="recipients[]" value="" /> <div id="message_to"></div> </div> This works ok, but I have been unable to work out how to append to the recipients[] array only replace with the new label. Moving on from this, I also need to know how to then remove this value from the array. Thanks in advance!

    Read the article

  • jQuery Form Processing With PHP to MYSQL Database Using $.ajax Request

    - by FrustratedUser
    Question: How can I process a form using jQuery and the $.ajax request so that the data is passed to a script which writes it to a database? Problem: I have a simple email signup form that when processed, adds the email along with the current date to a table in a MySQL database. Processing the form without jQuery works as intended, adding the email and date. With jQuery, the form submits successfully and returns the success message. However, no data is added to the database. Any insight would be greatly appreciated! <!-- PROCESS.PHP --> <?php // DB info $dbhost = '#'; $dbuser = '#'; $dbpass = '#'; $dbname = '#'; // Open connection to db $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); // Form variables $email = $_POST['email']; $submitted = $_POST['submitted']; // Clean up function cleanData($str) { $str = trim($str); $str = strip_tags($str); $str = strtolower($str); return $str; } $email = cleanData($email); $error = ""; if(isset($submitted)) { if($email == '') { $error .= '<p class="error">Please enter your email address.</p>' . "\n"; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) { $error .= '<p class="error">Please enter a valid email address.</p>' . "\n"; } if(!$error){ echo '<p id="signup-success-nojs">You have successfully subscribed!</p>'; // Add to database $add_email = "INSERT INTO subscribers (email,date) VALUES ('$email',CURDATE())"; mysql_query($add_email) or die(mysql_error()); }else{ echo $error; } } ?> <!-- SAMPLE.PHP --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sample</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ // Email Signup $("form#newsletter").submit(function() { var dataStr = $("#newsletter").serialize(); alert(dataStr); $.ajax({ type: "POST", url: "process.php", data: dataStr, success: function(del){ $('form#newsletter').hide(); $('#signup-success').fadeIn(); } }); return false; }); }); </script> <style type="text/css"> #email { margin-right:2px; padding:5px; width:145px; border-top:1px solid #ccc; border-left:1px solid #ccc; border-right:1px solid #eee; border-bottom:1px solid #eee; font-size:14px; color:#9e9e9e; } #signup-success { margin-bottom:20px; padding-bottom:10px; background:url(../img/css/divider-dots.gif) repeat-x 0 100%; display:none; } #signup-success p, #signup-success-nojs { padding:5px; background:#fff; border:1px solid #dedede; text-align:center; font-weight:bold; color:#3d7da5; } </style> </head> <body> <?php include('process.php'); ?> <form id="newsletter" class="divider" name="newsletter" method="post" action=""> <fieldset> <input id="email" type="text" name="email" /> <input id="submit-button" type="image" src="<?php echo $base_url; ?>/assets/img/css/signup.gif" alt=" SIGNUP " /> <input id="submitted" type="hidden" name="submitted" value="true" /> </fieldset> </form> <div id="signup-success"><p>You have successfully subscribed!</p></div> </body> </html>

    Read the article

  • BST insert operation. don't insert a node if a duplicate exists already

    - by jeev
    the following code reads an input array, and constructs a BST from it. if the current arr[i] is a duplicate, of a node in the tree, then arr[i] is discarded. count in the struct node refers to the number of times a number appears in the array. fi refers to the first index of the element found in the array. after the insertion, i am doing a post-order traversal of the tree and printing the data, count and index (in this order). the output i am getting when i run this code is: 0 0 7 0 0 6 thank you for your help. Jeev struct node{ int data; struct node *left; struct node *right; int fi; int count; }; struct node* binSearchTree(int arr[], int size); int setdata(struct node**node, int data, int index); void insert(int data, struct node **root, int index); void sortOnCount(struct node* root); void main(){ int arr[] = {2,5,2,8,5,6,8,8}; int size = sizeof(arr)/sizeof(arr[0]); struct node* temp = binSearchTree(arr, size); sortOnCount(temp); } struct node* binSearchTree(int arr[], int size){ struct node* root = (struct node*)malloc(sizeof(struct node)); if(!setdata(&root, arr[0], 0)) fprintf(stderr, "root couldn't be initialized"); int i = 1; for(;i<size;i++){ insert(arr[i], &root, i); } return root; } int setdata(struct node** nod, int data, int index){ if(*nod!=NULL){ (*nod)->fi = index; (*nod)->left = NULL; (*nod)->right = NULL; return 1; } return 0; } void insert(int data, struct node **root, int index){ struct node* new = (struct node*)malloc(sizeof(struct node)); setdata(&new, data, index); struct node** temp = root; while(1){ if(data<=(*temp)->data){ if((*temp)->left!=NULL) *temp=(*temp)->left; else{ (*temp)->left = new; break; } } else if(data>(*temp)->data){ if((*temp)->right!=NULL) *temp=(*temp)->right; else{ (*temp)->right = new; break; } } else{ (*temp)->count++; free(new); break; } } } void sortOnCount(struct node* root){ if(root!=NULL){ sortOnCount(root->left); sortOnCount(root->right); printf("%d %d %d\n", (root)->data, (root)->count, (root)->fi); } }

    Read the article

  • How to show processing form in my main form

    - by Royson
    Hi I want to show processing image in form when my main form is working. I have created processing form . I tried it with ProcessingForm obj = new ProcessingForm(); obj.show(); DOSomeStuff(); obj.close(); it shows processing form..but some time it becomes not responding...or my gif image stops animating. How to do that??

    Read the article

  • Generating documents with templating from a form

    - by Anna
    Hello, I would like to create a document generator with templating. The workflow should be as following: The user input data to a static form (simple text input). The user chooses a graphically designed template. A document with the chosen template containing the user data is generated. The initial templates repository is prepared in advance, but it should be easy to add new templates to the process. I have the full MS Office suite and the preferred file format is an MS .doc. I can do a little VB scripting if needed, but I prefer not to. Any advice would be greatly appreciated. Thank you, Anna

    Read the article

  • Best Linux Distro for web services (Nginx & node.js) on laptop: Compaq 6710b?

    - by tomByrer
    I haven't used Linux in 5+ years, aside from d/l occasional system recovery CDs off DistroWatch, so I don't know the current landscape. Related postings on this forum are several years old & may not relate to my hardware (Compaq 6710b laptop, Core2Duo Centrino). Requirements: Use the Compaq 6710b laptop's WiFi out of the box enough frequently updated pre-made packages for web hosting & development (Nginx & node.js are biggest concerns, everyone has Apache & PHP, & I'm not crazy about building from source) prefer be easy enough to use, but outside help available (so a small user-base distro is only OK if the community is active & a major disto's packages are compatable) configuration easy to transfer to outside web hosts. You have actually installed/used recommended disto (don't have to be expert) TIA!

    Read the article

  • Deploying Socket.IO App to Windows Azure Web Site with Azure CLI

    - by shiju
    In this blog post, I will demonstrate how to deploy Socket.IO app to Windows Azure Website using Windows Azure Cross-Platform Command-Line Interface, which leverages the Windows Azure Website’s new support for Web Sockets. Recently Windows Azure has announced lot of enhancements including the support for Web Sockets in Windows Azure Websites, which lets the Node.js developers deploy Socket.IO apps to Windows Azure Websites. In this blog post, I am using  Windows Azure CLI for create and deploy Windows Azure Website. Install  Windows Azure CLI The Windows Azure CLI available as a NPM module so that you can install Windows Azure CLI using  NPM as shown in the below command. After installing the azure-cli, just enter the command “azure” which will show the useful commands provided by Azure CLI. Import Windows Azure Subscription Account In order to import our Azure subscription account, we need to download the Windows Azure subscription profile. The Azure CLI command “account download” lets you download the  Windows Azure subscription profile as shown in the below command. The command redirect you login to Windows Azure portal and allow you to download the Windows Azure publish settings file. The account import command lets you import the downloaded publish settings file so that you can create and manage Websites, Cloud Services, Virtual Machines and Mobile Services in Windows Azure. Create Windows Azure Website and Enable Web Sockets In this post, we are going to deploy Socket.IO app to Windows Azure Website by using the Web Socket support provided by Windows Azure. Let’s create a Website named “socketiochatapp” using the Azure CLI. The above command will create a Windows Azure Website that will also initialize a Git repository with a remote named Azure. We can see the newly created Website from Azure portal. By default, the Web Sockets will be disabled. So let’s enable it by navigating to the Configure tab of the Website, and select “ON” in Web Sockets option and save the configuration changes. Deploy a Node.js Socket.IO App to Windows Azure Now, our Windows Azure Website supports Web Sockets so that we can easily deploy Socket.IO app to Windows Azure Website. Let’s add Node.js chat app which leverages Socket.IO module. Please note that you have to add npm module dependencies in the package.json file so that Windows Azure can install the dependencies when deploying the app. Let’s add the Node.js app and add the files to git repository. Let’s commit the changes to git repository. We have committed the changes to git local repository. Let’s push the changes to Windows Azure production environment. The successful deployment can see from the Windows Azure portal by navigating to the deployments tab of the selected Windows Azure Website. The screen shot below shows that our chat app is running successfully.   You can follow me on Twitter @shijucv

    Read the article

  • How to install NPM behind authentication proxy on Windows?

    - by Tobias
    I need to run the latest version of Node and NPM on Windows. I installed Node 0.5.8 and downloaded the sources of NPM from GitHub. The steps I followed to install NPM were listed on its GitHub site but I have a problem running the following command: node cli.js install npm -gf but it fails with the following error message: Error: connect UNKNOWN at errnoException (net_uv.js:566:11) at Object.afterConnect [as oncomplete] (net_uv.js:557:18) System Windows_NT 5.1.2600 command "...\\Node\\bin\\node.exe" "...\\npm\\cli.js" "install" "npm" "-gf" cwd ...\npm node -v v0.5.8 npm -v 1.0.94 code UNKNOWN I think that this is a problem because I need authentication at my proxy to connect to the Internet. But I found no way to tell the installer to use my credentials for login. Is there a possibility to provide my proxy IP and login information to npm installation maybe via command-line arguments? I can provide the full log (but seems to have no more relevant information) using pastebin if needed.

    Read the article

  • How To: Spell Check InfoPath web form in SharePoint 2010

    - by Jeremy Ramos
    Originally posted on: http://geekswithblogs.net/JeremyRamos/archive/2013/11/07/how-to-spell-check-infopath-web-form-in-sharepoint-2010.aspxThis is a sequel to my 2011 post about How To: Spell Check InfoPath Web Form in SharePoint. This time I will share how I managed to achieve Spell Checking in SharePoint 2010. This time round, we have changed our Online Forms strategy to use Custom lists instead of Form Libraries. I thought everything will be smooth sailing as we are using all OOTB features. So, we customised a Custom list form using InfoPath and added a few Rich Text Boxes (Spell Check is a requirement for this specific project). All is good in the InfoPath client including the Spell Checker so, happy days, I published straight away.Here comes the surprises now. I browsed to my Custom List and clicked Add New Item. This launched my Form in a modal dialog format. I went to my Rich Text Boxes to check the spell checker, and voila, it's disabled!I tried hacking the FormServer.aspx and the CustomSpellCheckEntirePage.js again but the new FormServer.aspx behaves differently than of MOSS 2007's. I searched for answers in many blogs to no avail. Often ending up being linked to my old blog post. I also tried placing the spell check javascript into a Content Editor Webpart of the Item's New Form and Edit form. It is launching the Spell Check dialog but it's not spellchecking the page correctly.At this point, I decided I needed to get my project across ASAP so enough with experimentations and logged a ticket with Microsoft Premier Support.On a call with the Support Engineer, I browsed through the Custom List and to the item to demonstrate my problem. Suddenly, the Spell Check tab in the toolbar is now Enabled! Surprised? Not much, it's Microsoft!Anyway, to cut my story short, here is a summary of my solution:Navigate to your Custom ListIn the Ribbon Toolbar, navigate to List > Customize List > Form Web Parts > Content Type Forms > (Item) New Form. This will display the newifs.aspx which is the page displayed when Add New Item is clicked. This page, just like any other SharePoint page, contains webparts. In this case, we have the InfoPath Form Web Part.Add a Content Editor Web Part (CEWP) on top of the InfoPath Form Web Part. (A blank CEWP would do for this example)Navigate to Page and click Stop EditingClick Add New Item again and navigate to a Rich Text box. Tadah! The Spell Check tab is now enabled!Do the same steps for the (Item) Edit Form to enable Spell Checks when editing an item.This "no code" solution discovered purely by accident!

    Read the article

  • What are some options and methods to link a contact form on WordPress to an existing form processing script?

    - by eirlymeyer
    I’m searching for the best way to link the outgoing/output data in a WordPress contact form plugin on a WordPress website to an existing MySQL database where a contact form is processed. Scenario: A new site (Site A) is being developed with a contact form. Site B (old site) uses a contact form script to process contact form leads through an existing legacy database and a ColdFusion application. The goal is to create site A with a new contact form to continue the same existing processes. Site A is to become the new Site B.

    Read the article

  • onclick form submit, open jQuery loading image until form submit complete

    - by Jackson
    Hi Team, Can you offer a bit of advice. I am using a hosted SAAS CMS solution that enables you to create basing apps with a web apps system. I have created a form for members to submit a bunch of images and content to their own area. Everything is working great except if the images being submitted via the form are large, it takes ages for the form to submit and go to the thank you page. I am already using jQuery UI to split the form in to 5 steps and using the jQuery facebox plugin for instructional popups. My question is, what would be the best way to display a loading gif (in facebox or in another suggested overlay) while the form is being submitted? Thanks for your help! Jack

    Read the article

  • How to send html form data from one form to multiple database tables

    - by user1701556
    I am able to send html form data to database using hibernate. I am using mySQL, Hibernate, Java 1.6, Spriong 3.0. But I would like to send that same data to multiple tables in the database. My issue is that I want to use only one html form not multiple html form. I have these tables: name, address, email, login, phone_num. From this one html form I want data to go to different tables depending on what the data is. I want to do it using Hibernate so that I am not manually taking form data and inserting it in the database. Please let me know if this is possible.

    Read the article

  • Drupal Webforms module - Form results say "Array" instead of form values

    - by Doc Falken
    I have a simple form built with the Webforms module in Drupal. The standard textfield form fields work perfectly. However if I use the preset date or time form values, they don't get emailed properly when the form is submitted. For instance, if there was a date field in my form, it would submit fine and render on the results page just fine, but if I wanted that value to be included in an email, it would show up as "Array" within the text of the email instead of showing the date. There is an open support issue within the module issues page, but I'm hoping for any additional help.

    Read the article

  • Refresh the Parent form of "Call_form" after Child form is closed in Oracle 10g

    - by DotNetDan
    What I need is: what trigger to use and where to put it. I will give you an example of what I am doing. I have a Contract form that is fully editable except the contract financial areas, which is read only. I want the user to press a button called, “change rates” and that will have a trigger “When-Button-Pressed” and call_form(UpdateFinancials);. Now, in this screen, I have the user change the financial information such as increase the contract from 50k to 100k. Then the user saves and exits. This will then close the child form "UpdateFinancials" and show the parent form "ContractForm". The problem is, it still has all the old information on it. I need the information in the form to refresh when it gets back from the child form of the Call_Form function.

    Read the article

  • Clear the form once form submitted

    - by zurna
    Once the form submitted, response from another page is printed to #GameStorySys. But values entered to the form still stays there. Is it possible for the form values to disappear (but the form should still stay) once the form submitted? $("[name='GameStoryForm']").click(function() { $.ajax({ type: "POST", data: $("#GameStoryForm").serialize(), url: "content/commentary/index.cs.asp?Process=EditLiveCommentaryStory&CommentaryID=<%=Request.QueryString("CommentaryID")%>", success: function(output) { $('#GameStorySys').html(output); }, error: function(output) { $('#GameStorySys').html(output); } }); });

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >