Search Results

Search found 430 results on 18 pages for 'maxlength'.

Page 5/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • remember passowrd works in ff but not in ie and chrome

    - by jasperdejong
    Hi, It seems that my html login form support remember password in ff but not in ie and chrome. Can anybody tell me why? Here's the code: <form name="login_form" id="login_form" action="" method="POST"> <div class="login_line">name<input name="user_name" id="user_name_id" size="16" maxlength="16" value="" type="text"></div> <div class="login_line">password<input name="password" id="password_id" size="16" maxlength="16" type="password"></div> <div class="login_line">&nbsp;<input class="icon icon_accept" value="login" onclick="javascript:handleFunction('action_login', document.getElementById('user_name_id').value, document.getElementById('password_id').value); return false;" type="submit"></div> </form> <!-- login_form -->

    Read the article

  • Fill 4 input with one textarea

    - by Patrice Poliquin
    I have a question for the community. My problem is that I have 4 input files with a maxlength of 60 caracters for a total of 240 caracters. Because the "backend" of the customer's system, it need to be 4 differents inputs max to be inserted and they say it is not user-friendly to fill 4 fields. My solution I want to make a textarea and when you fill it, il complete the 4 fields. [input text #1] max60 [input text #2] max60 [input text #3] max60 [input text #4] max60 [textarea max 240] What I am trying to do is to make by javascript/jQuery to fill up the four field while typing in. At the moment, here is my code. $(document).ready(function() { // My text area $("#inf_notes").bind('keydown', function () { var maxLength = 240; if ($(this).val().length <= 60) { // The first 60 caracters $('#inf_notes_1').val($(this).val()); } if ($(this).val().length > 60 && $(this).val().length <= 120) { // If more then 60, fill the second field $('#inf_notes_2').val($(this).val()); } // If 121 - 180 ... // If 181 - 240 ... if($(this).val().length == 240) { $(this).val($(this).val().substring(0, maxLength)); $('.alert_textarea').show(); // Simple alert else { $('.alert_textarea').hide(); } }); }); It actually works for the first one, but I would like to have some feedbacks to help me complete the script to fill the 3 nexts. Any guess to complete it? -- EDIT #1 I found a way that could maybe work! When the first input is completly filled, it will jump to the next field with a .focus() $(".inf_notes").bind('keydown', function () { var notes1 = $('#inf_notes_1').val(); var notes2 = $('#inf_notes_2').val(); var notes3 = $('#inf_notes_3').val(); if (notes1.length == 60) { $('#inf_notes_2').focus(); } if (notes2.length == 60) { $('#inf_notes_3').focus(); } if (notes3.length == 60) { $('#inf_notes_4').focus(); } });

    Read the article

  • Multiple Forms with Different Actions using Submit Buttons

    - by Adam Coulson
    I have Two forms in my index.php and am trying to get them to submit and POST their data seperatly Form 1 echo '<form action="process.php?type=news" method="post">'; echo '<table cellspacing="0"><tr><th>'; echo 'Add News to News Feed'; echo '</th></tr><tr><td>'; echo 'Title:<br /><input name="newstitle" type="text" id="add" style="height:16px;width:525px;" size="80" maxlength="186" /><br />'; echo 'Main Body Text:<br /><textarea name="newsfeed" id="add" style="width:525px;height:78px;" maxlength="2000" ></textarea>'; echo '<input style="float:right;margin-top:5px;" id="button" type="submit" value="Submit" />'; echo '</td></tr></table></from>'; And Form 2 echo '<form action="process.php?type=suggest" method="post">'; echo '<table cellspacing="0"><tr><th>'; echo 'Suggest Additions to the Intranet'; echo '</th></tr><tr><td>'; echo '<textarea name="suggest" id="add" style="width:330px;height:60px;" maxlength="800" ></textarea>'; echo '<input style="float:right;margin-top:5px;" id="button" type="submit" value="Submit" />'; echo '</td></tr></table></from>'; I want these both to post and do the action after pressing the submit button, but currently the second form submit to the first forms action How can i fix this??? EDIT: Also i am using .PHP for both the index and process page then using it to echo the forms onto the page Also here is the process.php data $type=$_REQUEST['type']; $suggest=$_POST['suggest']; $newstitle=$_POST['newstitle']; $news=mysql_real_escape_string($_POST['newsfeed']); if ($type == "news") { $sql=mysql_query("SELECT * FROM newsfeed WHERE title = ('$newstitle')"); $number_of_rows = mysql_num_rows($sql); if ($number_of_rows > 0) { echo 'This Title is Already Taken'; } else { $sql="INSERT INTO newsfeed (title, news) VALUES ('$newstitle','$news')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header('Location: index.php'); exit; } } elseif ($type == "suggest") { $sql="INSERT INTO suggestions VALUES ('$suggest')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header('Location: index.php'); exit; }

    Read the article

  • Best way to handle storing (possibly NULL) char * in a std::string

    - by John
    class MyClass { public: void setVar(const char *str); private: std::string mStr; int maxLength; //we only store string up to this length }; What's the best approach to implement setVar when the external code is quite likely to pass in NULL for an empty string (and cannot be changed)? I currently do something a bit like: void MyClass::setVar(const char *str) { mStr.assign(str ? str : "",maxLength); } But it seems kind of messy. ideas?

    Read the article

  • Compare two date whit jquery

    - by Mercer
    Hello, i have two String fields who represent Date in my page and i would to compare this two fields to know if my first date < second date <tr> <td align="right">First Date: </td> <td align="left"> <html:text name="addPublicationForm" styleId="firstDate" property="firstDate" maxlength="10"/></td> </tr> <tr> <td align="right">Second Date: </td> <td align="left"> <html:text name="addPublicationForm" styleId="secondDate" property="secondDate" maxlength="10"/></td>

    Read the article

  • Extending NerdDinner: Adding Geolocated Flair

    - by Jon Galloway
    NerdDinner is a website with the audacious goal of “Organizing the world’s nerds and helping them eat in packs.” Because nerds aren’t likely to socialize with others unless a website tells them to do it. Scott Hanselman showed off a lot of the cool features we’ve added to NerdDinner lately during his popular talk at MIX10, Beyond File | New Company: From Cheesy Sample to Social Platform. Did you miss it? Go ahead and watch it, I’ll wait. One of the features we wanted to add was flair. You know about flair, right? It’s a way to let folks who like your site show it off in their own site. For example, here’s my StackOverflow flair: Great! So how could we add some of this flair stuff to NerdDinner? What do we want to show? If we’re going to encourage our users to give up a bit of their beautiful website to show off a bit of ours, we need to think about what they’ll want to show. For instance, my StackOverflow flair is all about me, not StackOverflow. So how will this apply to NerdDinner? Since NerdDinner is all about organizing local dinners, in order for the flair to be useful it needs to make sense for the person viewing the web page. If someone visits from Egypt visits my blog, they should see information about NerdDinners in Egypt. That’s geolocation – localizing site content based on where the browser’s sitting, and it makes sense for flair as well as entire websites. So we’ll set up a simple little callout that prompts them to host a dinner in their area: Hopefully our flair works and there is a dinner near your viewers, so they’ll see another view which lists upcoming dinners near them: The Geolocation Part Generally website geolocation is done by mapping the requestor’s IP address to a geographic area. It’s not an exact science, but I’ve always found it to be pretty accurate. There are (at least) three ways to handle it: You pay somebody like MaxMind for a database (with regular updates) that sits on your server, and you use their API to do lookups. I used this on a pretty big project a few years ago and it worked well. You use HTML 5 Geolocation API or Google Gears or some other browser based solution. I think those are cool (I use Google Gears a lot), but they’re both in flux right now and I don’t think either has a wide enough of an install base yet to rely on them. You might want to, but I’ve heard you do all kinds of crazy stuff, and sometimes it gets you in trouble. I don’t mean talk out of line, but we all laugh behind your back a bit. But, hey, it’s up to you. It’s your flair or whatever. There are some free webservices out there that will take an IP address and give you location information. Easy, and works for everyone. That’s what we’re doing. I looked at a few different services and settled on IPInfoDB. It’s free, has a great API, and even returns JSON, which is handy for Javascript use. The IP query is pretty simple. We hit a URL like this: http://ipinfodb.com/ip_query.php?ip=74.125.45.100&timezone=false … and we get an XML response back like this… <?xml version="1.0" encoding="UTF-8"?> <Response> <Ip>74.125.45.100</Ip> <Status>OK</Status> <CountryCode>US</CountryCode> <CountryName>United States</CountryName> <RegionCode>06</RegionCode> <RegionName>California</RegionName> <City>Mountain View</City> <ZipPostalCode>94043</ZipPostalCode> <Latitude>37.4192</Latitude> <Longitude>-122.057</Longitude> </Response> So we’ll build some data transfer classes to hold the location information, like this: public class LocationInfo { public string Country { get; set; } public string RegionName { get; set; } public string City { get; set; } public string ZipPostalCode { get; set; } public LatLong Position { get; set; } } public class LatLong { public float Lat { get; set; } public float Long { get; set; } } And now hitting the service is pretty simple: public static LocationInfo HostIpToPlaceName(string ip) { string url = "http://ipinfodb.com/ip_query.php?ip={0}&timezone=false"; url = String.Format(url, ip); var result = XDocument.Load(url); var location = (from x in result.Descendants("Response") select new LocationInfo { City = (string)x.Element("City"), RegionName = (string)x.Element("RegionName"), Country = (string)x.Element("CountryName"), ZipPostalCode = (string)x.Element("CountryName"), Position = new LatLong { Lat = (float)x.Element("Latitude"), Long = (float)x.Element("Longitude") } }).First(); return location; } Getting The User’s IP Okay, but first we need the end user’s IP, and you’d think it would be as simple as reading the value from HttpContext: HttpContext.Current.Request.UserHostAddress But you’d be wrong. Sorry. UserHostAddress just wraps HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], but that doesn’t get you the IP for users behind a proxy. That’s in another header, “HTTP_X_FORWARDED_FOR". So you can either hit a wrapper and then check a header, or just check two headers. I went for uniformity: string SourceIP = string.IsNullOrEmpty(Request.ServerVariables["HTTP_X_FORWARDED_FOR"]) ? Request.ServerVariables["REMOTE_ADDR"] : Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; We’re almost set to wrap this up, but first let’s talk about our views. Yes, views, because we’ll have two. Selecting the View We wanted to make it easy for people to include the flair in their sites, so we looked around at how other people were doing this. The StackOverflow folks have a pretty good flair system, which allows you to include the flair in your site as either an IFRAME reference or a Javascript include. We’ll do both. We have a ServicesController to handle use of the site information outside of NerdDinner.com, so this fits in pretty well there. We’ll be displaying the same information for both HTML and Javascript flair, so we can use one Flair controller action which will return a different view depending on the requested format. Here’s our general flow for our controller action: Get the user’s IP Translate it to a location Grab the top three upcoming dinners that are near that location Select the view based on the format (defaulted to “html”) Return a FlairViewModel which contains the list of dinners and the location information public ActionResult Flair(string format = "html") { string SourceIP = string.IsNullOrEmpty( Request.ServerVariables["HTTP_X_FORWARDED_FOR"]) ? Request.ServerVariables["REMOTE_ADDR"] : Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; var location = GeolocationService.HostIpToPlaceName(SourceIP); var dinners = dinnerRepository. FindByLocation(location.Position.Lat, location.Position.Long). OrderByDescending(p => p.EventDate).Take(3); // Select the view we'll return. // Using a switch because we'll add in JSON and other formats later. string view; switch (format.ToLower()) { case "javascript": view = "JavascriptFlair"; break; default: view = "Flair"; break; } return View( view, new FlairViewModel { Dinners = dinners.ToList(), LocationName = string.IsNullOrEmpty(location.City) ? "you" : String.Format("{0}, {1}", location.City, location.RegionName) } ); } Note: I’m not in love with the logic here, but it seems like overkill to extract the switch statement away when we’ll probably just have two or three views. What do you think? The HTML View The HTML version of the view is pretty simple – the only thing of any real interest here is the use of an extension method to truncate strings that are would cause the titles to wrap. public static string Truncate(this string s, int maxLength) { if (string.IsNullOrEmpty(s) || maxLength <= 0) return string.Empty; else if (s.Length > maxLength) return s.Substring(0, maxLength) + "..."; else return s; }   So here’s how the HTML view ends up looking: <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<FlairViewModel>" %> <%@ Import Namespace="NerdDinner.Helpers" %> <%@ Import Namespace="NerdDinner.Models" %> <!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"> <head> <title>Nerd Dinner</title> <link href="/Content/Flair.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="nd-wrapper"> <h2 id="nd-header">NerdDinner.com</h2> <div id="nd-outer"> <% if (Model.Dinners.Count == 0) { %> <div id="nd-bummer"> Looks like there's no Nerd Dinners near <%:Model.LocationName %> in the near future. Why not <a target="_blank" href="http://www.nerddinner.com/Dinners/Create">host one</a>?</div> <% } else { %> <h3> Dinners Near You</h3> <ul> <% foreach (var item in Model.Dinners) { %> <li> <%: Html.ActionLink(String.Format("{0} with {1} on {2}", item.Title.Truncate(20), item.HostedBy, item.EventDate.ToShortDateString()), "Details", "Dinners", new { id = item.DinnerID }, new { target = "_blank" })%></li> <% } %> </ul> <% } %> <div id="nd-footer"> More dinners and fun at <a target="_blank" href="http://nrddnr.com">http://nrddnr.com</a></div> </div> </div> </body> </html> You’d include this in a page using an IFRAME, like this: <IFRAME height=230 marginHeight=0 src="http://nerddinner.com/services/flair" frameBorder=0 width=160 marginWidth=0 scrolling=no></IFRAME> The Javascript view The Javascript flair is written so you can include it in a webpage with a simple script include, like this: <script type="text/javascript" src="http://nerddinner.com/services/flair?format=javascript"></script> The goal of this view is very similar to the HTML embed view, with a few exceptions: We’re creating a script element and adding it to the head of the document, which will then document.write out the content. Note that you have to consider if your users will actually have a <head> element in their documents, but for website flair use cases I think that’s a safe bet. Since the content is being added to the existing page rather than shown in an IFRAME, all links need to be absolute. That means we can’t use Html.ActionLink, since it generates relative routes. We need to escape everything since it’s being written out as strings. We need to set the content type to application/x-javascript. The easiest way to do that is to use the <%@ Page ContentType%> directive. <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<NerdDinner.Models.FlairViewModel>" ContentType="application/x-javascript" %> <%@ Import Namespace="NerdDinner.Helpers" %> <%@ Import Namespace="NerdDinner.Models" %> document.write('<script>var link = document.createElement(\"link\");link.href = \"http://nerddinner.com/content/Flair.css\";link.rel = \"stylesheet\";link.type = \"text/css\";var head = document.getElementsByTagName(\"head\")[0];head.appendChild(link);</script>'); document.write('<div id=\"nd-wrapper\"><h2 id=\"nd-header\">NerdDinner.com</h2><div id=\"nd-outer\">'); <% if (Model.Dinners.Count == 0) { %> document.write('<div id=\"nd-bummer\">Looks like there\'s no Nerd Dinners near <%:Model.LocationName %> in the near future. Why not <a target=\"_blank\" href=\"http://www.nerddinner.com/Dinners/Create\">host one</a>?</div>'); <% } else { %> document.write('<h3> Dinners Near You</h3><ul>'); <% foreach (var item in Model.Dinners) { %> document.write('<li><a target=\"_blank\" href=\"http://nrddnr.com/<%: item.DinnerID %>\"><%: item.Title.Truncate(20) %> with <%: item.HostedBy %> on <%: item.EventDate.ToShortDateString() %></a></li>'); <% } %> document.write('</ul>'); <% } %> document.write('<div id=\"nd-footer\"> More dinners and fun at <a target=\"_blank\" href=\"http://nrddnr.com\">http://nrddnr.com</a></div></div></div>'); Getting IP’s for Testing There are a variety of online services that will translate a location to an IP, which were handy for testing these out. I found http://www.itouchmap.com/latlong.html to be most useful, but I’m open to suggestions if you know of something better. Next steps I think the next step here is to minimize load – you know, in case people start actually using this flair. There are two places to think about – the NerdDinner.com servers, and the services we’re using for Geolocation. I usually think about caching as a first attack on server load, but that’s less helpful here since every user will have a different IP. Instead, I’d look at taking advantage of Asynchronous Controller Actions, a cool new feature in ASP.NET MVC 2. Async Actions let you call a potentially long-running webservice without tying up a thread on the server while waiting for the response. There’s some good info on that in the MSDN documentation, and Dino Esposito wrote a great article on Asynchronous ASP.NET Pages in the April 2010 issue of MSDN Magazine. But let’s think of the children, shall we? What about ipinfodb.com? Well, they don’t have specific daily limits, but they do throttle you if you put a lot of traffic on them. From their FAQ: We do not have a specific daily limit but queries that are at a rate faster than 2 per second will be put in "queue". If you stay below 2 queries/second everything will be normal. If you go over the limit, you will still get an answer for all queries but they will be slowed down to about 1 per second. This should not affect most users but for high volume websites, you can either use our IP database on your server or we can whitelist your IP for 5$/month (simply use the donate form and leave a comment with your server IP). Good programming practices such as not querying our API for all page views (you can store the data in a cookie or a database) will also help not reaching the limit. So the first step there is to save the geolocalization information in a time-limited cookie, which will allow us to look up the local dinners immediately without having to hit the geolocation service.

    Read the article

  • Multiple validation using jquery

    - by Prasenjit
    <script type="text/javascript">           $(document).ready(                 function() {                     $("input[id$='btnOK']").click(function(event) {                         $("#form1").validate({                             rules: {                                 txtName: { required: true },                                 txtEmail: { required: true, email: true },                                 txtPostalAddress: { required: true, maxlength: 50 }                             },                             messages: {}, onsubmit: true                         });                     });                     $("input[id$='Button1']").click(function(event) {                         $("#form1").validate({                             rules: {                                 txtName: { required: true }                                                             },                             messages: {}, onsubmit: true                         });                     });                 });                             </script>

    Read the article

  • HTML5 Form: Page Is Reloading Instantly After Restyling (And It Shouldn't Be)

    - by user3689753
    I have a form. I have made it so that if your name is not put in, a red border is put on the name field. That works, BUT...it's for a split second, and then the page reloads. I want the red border to appear, and then stay there. For some reason it's for a split second. Can someone help me make it so the page doesn't reload after displaying the red border? Here's the script. window.onload = function() { document.getElementById("Hogwarts").onsubmit = function () { window.alert("Form submitted. Owl being sent..."); var fname = document.getElementById("fName"); if(!fName.value.match("^[A-Z][A-Za-z]+( [A-Z][A-Za-z]*)*$")) { window.alert("You must enter your name."); addClass(fName, "errorDisp"); document.getElementById("fName").focus(); } else return true; } } function addClass(element, classToAdd) { var currentClassValue = element.className; if (currentClassValue.indexOf(classToAdd) == -1) { if ((currentClassValue == null) || (currentClassValue === "")) { element.className = classToAdd; } else { element.className += " " + classToAdd; } } } function removeClass(element, classToRemove) { var currentClassValue = element.className; if (currentClassValue == classToRemove) { element.className = ""; return; } var classValues = currentClassValue.split(" "); var filteredList = []; for (var i = 0 ; i < classValues.length; i++) { if (classToRemove != classValues[i]) { filteredList.push(classValues[i]); } } element.className = filteredList.join(" "); } Here's the HTML. <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>Hogwarts School of Witchcraft And Wizardry Application Form</title> <link rel="stylesheet" type="text/css" href="main.css" media="screen"/> <script src="script.js" type="text/javascript"></script> </head> <body> <section> <header> <h1>Hogwarts School of Witchcraft And Wizardry</h1> <nav></nav> </header> <main> <form method="post" id="Hogwarts"> <!--<form action="showform.php" method="post" id="Hogwarts">--!> <fieldset id="aboutMe"> <legend id="aboutMeLeg">About Me</legend> <div class="fieldleading"> <label for="fName" class="labelstyle">First name:</label> <input type="text" id="fName" name="fName" autofocus maxlength="50" value="" placeholder="First Name" size="30"> <label for="lName" class="labelstyle">Last name:</label> <input type="text" id="lName" name="lName" required maxlength="50" value="" placeholder="Last Name" pattern="^[A-Za-z ]{3,}$" size="30"> <label for="age" class="labelstyle">Age:</label> <input type="number" id="age" name="age" required min="17" step="1" max="59" value="" placeholder="Age"> </div> <div class="fieldleading"> <label for="date" class="labelstyle">Date Of Birth:</label> <input type="date" name="date1" id="date" required autofocus value=""> </div> <div id="whitegender"> <div class="fieldleading"> <label class="labelstyle">Gender:</label> </div> <input type="radio" name="sex" value="male" class="gender" required="required">Male<br/> <input type="radio" name="sex" value="female" class="gender" required="required">Female<br/> <input type="radio" name="sex" value="other" class="gender" required="required">Other </div> </fieldset> <fieldset id="contactInfo"> <legend id="contactInfoLeg">Contact Information</legend> <div class="fieldleading"> <label for="street" class="labelstyle">Street Address:</label> <input type="text" id="street" name="street" required autofocus maxlength="50" value="" placeholder="Street Address" pattern="^[0-9A-Za-z\. ]+{5,}$" size="35"> <label for="city" class="labelstyle">City:</label> <input type="text" id="city" name="city" required autofocus maxlength="30" value="" placeholder="City" pattern="^[A-Za-z ]{3,}$" size="35"> <label for="State" class="labelstyle">State:</label> <select required id="State" name="State" > <option value="Select Your State">Select Your State</option> <option value="Delaware">Delaware</option> <option value="Pennsylvania">Pennsylvania</option> <option value="New Jersey">New Jersey</option> <option value="Georgia">Georgia</option> <option value="Connecticut">Connecticut</option> <option value="Massachusetts">Massachusetts</option> <option value="Maryland">Maryland</option> <option value="New Hampshire">New Hampshire</option> <option value="New York">New York</option> <option value="Virginia">Virginia</option> </select> </div> <div class="fieldleading"> <label for="zip" class="labelstyle">5-Digit Zip Code:</label> <input id="zip" name="zip" required autofocus maxlength="5" value="" placeholder="Your Zip Code" pattern="^\d{5}$"> <label for="usrtel" class="labelstyle">10-Digit Telephone Number:</label> <input type="tel" name="usrtel" id="usrtel" required autofocus value="" placeholder="123-456-7890" pattern="^\d{3}[\-]\d{3}[\-]\d{4}$"> </div> <div class="fieldleading"> <label for="email1" class="labelstyle">Email:</label> <input type="email" name="email1" id="email1" required autofocus value="" placeholder="[email protected]" pattern="^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" size="35"> <label for="homepage1" class="labelstyle">Home Page:</label> <input type="url" name="homepage1" id="homepage1" required autofocus value="" placeholder="http://www.hp.com" pattern="https?://.+" size="35"> </div> </fieldset> <fieldset id="yourInterests"> <legend id="yourInterestsLeg">Your Interests</legend> <label for="Major" class="labelstyle">Major/Program Choice:</label> <select required id="Major" name="Major" > <option value="">Select Your Major</option> <option value="Magic1">Magic Horticulture</option> <option value="Magic2">Black Magic</option> <option value="White">White Magic</option> <option value="Blue">Blue Magic</option> <option value="Non">Non-Wizardry Studies</option> </select> </fieldset> <button type="submit" value="Submit" class="submitreset">Submit</button> <button type="reset" value="Reset" class="submitreset">Reset</button> </form> </main> <footer> &copy; 2014 Bennett Nestok </footer> </section> </body> </html> Here's the CSS. a:link { text-decoration: none !important; color:black !important; } a:visited { text-decoration: none !important; color:red !important; } a:active { text-decoration: none !important; color:green !important; } a:hover { text-decoration: none !important; color:blue !important; background-color:white !important; } ::-webkit-input-placeholder { color: #ffffff; } /* gray80 */ :-moz-placeholder { color: #ffffff; } /* Firefox 18- (one color)*/ ::-moz-placeholder { color: #ffffff; } /* Firefox 19+ (double colons) */ :-ms-input-placeholder { color: #ffffff; } body { margin: 0px auto; text-align:center; background-color:grey; font-weight:normal; font-size:12px; font-family: verdana; color:black; background-image:url('bgtexture.jpg'); background-repeat:repeat; } footer { text-align:center; margin: 0px auto; bottom:0px; position:absolute; width:100%; color:white; background-color:black; height:20px; padding-top:4px; } h1 { color:white; text-align:center; margin: 0px auto; margin-bottom:50px; width:100%; background-color:black; padding-top: 13px; padding-bottom: 14px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } button.submitreset { -moz-border-radius: 400px; -webkit-border-radius: 400px; border-radius: 400px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } .labelstyle { background-color:#a7a7a7; color:black; -moz-border-radius: 400px; -webkit-border-radius: 400px; border-radius: 400px; padding:3px 3px 3px 3px; } #aboutMe, #contactInfo, #yourInterests { margin-bottom:30px; text-align:left !important; padding: 10px 10px 10px 10px; } #Hogwarts { text-align:center; margin:0px auto; width:780px; padding-top: 20px !important; padding-bottom: 20px !important; background: -webkit-linear-gradient(#474747, grey); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(#474747, grey); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(#474747, grey); /* For Firefox 3.6 to 15 */ background: linear-gradient(#474747, grey); /* Standard syntax */ border-color:black; border-style: solid; border-width: 2px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } @media (max-width: 800px){ .labelstyle { display: none; } #Hogwarts { width:300px; } h1 { width:304px; margin-bottom:0px; } .fieldleading { margin-bottom:0px !important; } ::-webkit-input-label { /* WebKit browsers */ color: transparent; } :-moz-label { /* Mozilla Firefox 4 to 18 */ color: transparent; } ::-moz-label { /* Mozilla Firefox 19+ */ color: transparent; } :-ms-input-label { /* Internet Explorer 10+ */ color: transparent; } ::-webkit-input-placeholder { /* WebKit browsers */ color: grey !important; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: grey !important; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color: grey !important; } :-ms-input-placeholder { /* Internet Explorer 10+ */ color: grey !important; } #aboutMe, #contactInfo, #yourInterests { margin-bottom:10px; text-align:left !important; padding: 5px 5px 5px 5px; } } br { display: block; line-height: 10px; } .fieldleading { margin-bottom:10px; } legend { color:white; } #whitegender { color:white; } #moreleading { margin-bottom:10px; } /*opera only hack attempt*/ @media not all and (-webkit-min-device-pixel-ratio:0) { .fieldleading { margin-bottom:30px !important; } } .errorDisp { border-color: red; border-style: solid; border-width: 2px; }

    Read the article

  • Drupal Ctools Form Wizard in a Block

    - by Iamjon
    Hi everyone I created a custom module that has a Ctools multi step form. It's basically a copy of http://www.nicklewis.org/using-chaos-tools-form-wizard-build-multistep-forms-drupal-6. The form works. I can see it if I got to the url i made for it. For the life of me I can't get the multistep form to show up in a block. Any clues? /** * Implementation of hook_block() * */ function mycrazymodule_block($op='list', $delta=0, $edit=array()) { switch ($op) { case 'list': $blocks[0]['info'] = t('SFT Getting Started'); $blocks[1]['info'] = t('SFT Contact US'); $blocks[2]['info'] = t('SFT News Letter'); return $blocks; case 'view': switch ($delta){ case '0': $block['subject'] = t('SFT Getting Started Subject'); $block['content'] = mycrazymodule_wizard(); break; case '1': $block['subject'] = t('SFT Contact US Subject'); $block['content'] = t('SFT Contact US content'); break; case '2': $block['subject'] = t('SFT News Letter Subject'); $block['content'] = t('SFT News Letter cONTENT'); break; } return $block; } } /** * Implementation of hook_menu(). */ function mycrazymodule_menu() { $items['hellocowboy'] = array( 'title' = 'Two Step Form', 'page callback' = 'mycrazymodule_wizard', 'access arguments' = array('access content') ); return $items; } /** * menu callback for the multistep form * step is whatever arg one is -- and will refer to the keys listed in * $form_info['order'], and $form_info['forms'] arrays */ function mycrazymodule_wizard() { $step = arg(1); // required includes for wizard $form_state = array(); ctools_include('wizard'); ctools_include('object-cache'); // The array that will hold the two forms and their options $form_info = array( 'id' = 'getting_started', 'path' = "hellocowboy/%step", 'show trail' = FALSE, 'show back' = FALSE, 'show cancel' = false, 'show return' =false, 'next text' = 'Submit', 'next callback' = 'getting_started_add_subtask_next', 'finish callback' = 'getting_started_add_subtask_finish', 'return callback' = 'getting_started_add_subtask_finish', 'order' = array( 'basic' = t('Step 1: Basic Info'), 'lecture' = t('Step 2: Choose Lecture'), ), 'forms' = array( 'basic' = array( 'form id' = 'basic_info_form' ), 'lecture' = array( 'form id' = 'choose_lecture_form' ), ), ); $form_state = array( 'cache name' = NULL, ); // no matter the step, you will load your values from the callback page $getstart = getting_started_get_page_cache(NULL); if (!$getstart) { // set form to first step -- we have no data $step = current(array_keys($form_info['order'])); $getstart = new stdClass(); //create cache ctools_object_cache_set('getting_started', $form_state['cache name'], $getstart); //print_r($getstart); } //THIS IS WHERE WILL STORE ALL FORM DATA $form_state['getting_started_obj'] = $getstart; // and this is the witchcraft that makes it work $output = ctools_wizard_multistep_form($form_info, $step, $form_state); return $output; } function basic_info_form(&$form, &$form_state){ $getstart = &$form_state['getting_started_obj']; $form['firstname'] = array( '#weight' = '0', '#type' = 'textfield', '#title' = t('firstname'), '#size' = 60, '#maxlength' = 255, '#required' = TRUE, ); $form['lastname'] = array( '#weight' = '1', '#type' = 'textfield', '#title' = t('lastname'), '#required' = TRUE, '#size' = 60, '#maxlength' = 255, ); $form['phone'] = array( '#weight' = '2', '#type' = 'textfield', '#title' = t('phone'), '#required' = TRUE, '#size' = 60, '#maxlength' = 255, ); $form['email'] = array( '#weight' = '3', '#type' = 'textfield', '#title' = t('email'), '#required' = TRUE, '#size' = 60, '#maxlength' = 255, ); $form['newsletter'] = array( '#weight' = '4', '#type' = 'checkbox', '#title' = t('I would like to receive the newsletter'), '#required' = TRUE, '#return_value' = 1, '#default_value' = 1, ); $form_state['no buttons'] = TRUE; } function basic_info_form_validate(&$form, &$form_state){ $email = $form_state['values']['email']; $phone = $form_state['values']['phone']; if(valid_email_address($email) != TRUE){ form_set_error('Dude you have an error', t('Where is your email?')); } //if (strlen($phone) 0 && !ereg('^[0-9]{1,3}-[0-9]{3}-[0-9]{3,4}-[0-9]{3,4}$', $phone)) { //form_set_error('Dude the phone', t('Phone number must be in format xxx-xxx-nnnn-nnnn.')); //} } function basic_info_form_submit(&$form, &$form_state){ //Grab the variables $firstname =check_plain ($form_state['values']['firstname']); $lastname = check_plain ($form_state['values']['lastname']); $email = check_plain ($form_state['values']['email']); $phone = check_plain ($form_state['values']['phone']); $newsletter = $form_state['values']['newsletter']; //Send the form and Grab the lead id $leadid = send_first_form($lastname, $firstname, $email,$phone, $newsletter); //Put into form $form_state['getting_started_obj']-firstname = $firstname; $form_state['getting_started_obj']-lastname = $lastname; $form_state['getting_started_obj']-email = $email; $form_state['getting_started_obj']-phone = $phone; $form_state['getting_started_obj']-newsletter = $newsletter; $form_state['getting_started_obj']-leadid = $leadid; } function choose_lecture_form(&$form, &$form_state){ $one = 'event 1' $two = 'event 2' $three = 'event 3' $getstart = &$form_state['getting_started_obj']; $form['lecture'] = array( '#weight' = '5', '#default_value' = 'two', '#options' = array( 'one' = $one, 'two' = $two, 'three' = $three, ), '#type' = 'radios', '#title' = t('Select Workshop'), '#required' = TRUE, ); $form['attendees'] = array( '#weight' = '6', '#default_value' = 'one', '#options' = array( 'one' = t('I will be arriving alone'), 'two' =t('I will be arriving with a guest'), ), '#type' = 'radios', '#title' = t('Attendees'), '#required' = TRUE, ); $form_state['no buttons'] = TRUE; } /** * Same idea as previous steps submit * */ function choose_lecture_form_submit(&$form, &$form_state) { $workshop = $form_state['values']['lecture']; $leadid = $form_state['getting_started_obj']-leadid; $attendees = $form_state['values']['attendees']; $form_state['getting_started_obj']-lecture = $workshop; $form_state['getting_started_obj']-attendees = $attendees; send_second_form($workshop, $attendees, $leadid); } /*----PART 3 CTOOLS CALLBACKS -- these usually don't have to be very unique ---------------------- */ /** * Callback generated when the add page process is finished. * this is where you'd normally save. */ function getting_started_add_subtask_finish(&$form_state) { dpm($form_state); $getstart = &$form_state['getting_started_obj']; drupal_set_message('mycrazymodule '.$getstart-name.' successfully deployed' ); //Get id // Clear the cache ctools_object_cache_clear('getting_started', $form_state['cache name']); $form_state['redirect'] = 'hellocowboy'; } /** * Callback for the proceed step * */ function getting_started_add_subtask_next(&$form_state) { dpm($form_state); $getstart = &$form_state['getting_started_obj']; $cache = ctools_object_cache_set('getting_started', $form_state['cache name'], $getstart); } /*----PART 4 CTOOLS FORM STORAGE HANDLERS -- these usually don't have to be very unique ---------------------- */ /** * Remove an item from the object cache. */ function getting_started_clear_page_cache($name) { ctools_object_cache_clear('getting_started', $name); } /** * Get the cached changes to a given task handler. */ function getting_started_get_page_cache($name) { $cache = ctools_object_cache_get('getting_started', $name); return $cache; } //Salesforce Functions function send_first_form($lastname, $firstname,$email,$phone, $newsletter){ $send = array("LastName" = $lastname , "FirstName" = $firstname, "Email" = $email ,"Phone" = $phone , "Newsletter__c" =$newsletter ); $sf = salesforce_api_connect(); $response = $sf-client-create(array($send), 'Lead'); dpm($response); return $response-id; } function send_second_form($workshop, $attendees, $leadid){ $send = array("Id" = $leadid , "Number_Of_Pepole__c" = "2" ); $sf = salesforce_api_connect(); $response = $sf-client-update(array($send), 'Lead'); dpm($response, 'the final response'); return $response-id; }

    Read the article

  • change password code error

    - by ejah85
    I've created a code to change a password. Now it seem contain an error. When I fill in the form to change password, and click save the error message: Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103 Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103 I really don’t know what the error message means. Please guys. Help me fix it. Here's is the code: <?php session_start(); ?> <?php # change password.php //set the page title and include the html header. $page_title = 'Change Your Password'; //include('templates/header.inc'); if(isset($_POST['submit'])){//handle the form require_once('connectioncomplaint.php');//connect to the db. //include "connectioncomplaint.php"; //create a function for escaping the data. function escape_data($data){ global $dbc;//need the connection. if(ini_get('magic_quotes_gpc')){ $data=stripslashes($data); } return mysql_real_escape_string($data, $dbc); }//end function $message=NULL;//create the empty new variable. //check for a username if(empty($_POST['userid'])){ $u=FALSE; $message .='<p> You forgot enter your userid!</p>'; }else{ $u=escape_data($_POST['userid']); } //check for existing password if(empty($_POST['password'])){ $p=FALSE; $message .='<p>You forgot to enter your existing password!</p>'; }else{ $p=escape_data($_POST['password']); } //check for a password and match againts the comfirmed password. if(empty($_POST['password1'])) { $np=FALSE; $message .='<p> you forgot to enter your new password!</p>'; }else{ if($_POST['password1'] == $_POST['password2']){ $np=escape_data($_POST['password1']); }else{ $np=FALSE; $message .='<p> your new password did not match the confirmed new password!</p>'; } } if($u && $p && $np){//if everything's ok. $query="SELECT userid FROM access WHERE (userid='$u' AND password=PASSWORD('$p'))"; $result=@mysql_query($query); $num=mysql_num_rows($result); if($num == 1){ $row=mysql_fetch_array($result, MYSQL_NUM); //make the query $query="UPDATE access SET password=PASSWORD('$np') WHERE userid=$row[0]"; $result=@mysql_query($query);//run the query. if(mysql_affected_rows() == 1) {//if it run ok. //send an email,if desired. echo '<p><b>your password has been changed.</b></p>'; include('templates/footer.inc');//include the HTML footer. exit();//quit the script. }else{//if it did not run OK. $message= '<p>Your password could not be change due to a system error.We apolpgize for any inconvenience.</p><p>' .mysql_error() .'</p>'; } }else{ $message= '<p> Your username and password do not match our records.</p>'; } mysql_close();//close the database connection. }else{ $message .='<p>Please try again.</p>'; } }//end oh=f the submit conditional. //print the error message if there is one. if(isset($message)){ echo'<font color="red">' , $message, '</font>'; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <body> <script language="JavaScript1.2">mmLoadMenus();</script> <table width="604" height="599" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="130" colspan="7"><img src="images/banner(E-Complaint)-.jpg" width="759" height="130" /></td> </tr> <tr> <td width="100" height="30" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="100" bgcolor="#ABD519"></td> <td width="160" bgcolor="#ABD519"> <?php include "header.php"; ?>&nbsp;</td> </tr> <tr> <td colspan="7" bgcolor="#FFFFFF"> <fieldset><legend> Enter your information in the form below:</legend> <p><b>User ID:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if(isset($_POST['userid'])) echo $_POST['userid']; ?>" /></p> <p><b>Current Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p> <p><b>New Password:</b> <input type="password" name="password1" size="20" maxlength="20" /></p> <p><b>Confirm New Password:</b> <input type="password" name="password2" size="20" maxlength="20" /></p> </fieldset> <div align="center"> <input type="submit" name="submit" value="Change My Password" /></div> </form><!--End Form--> </td> </tr> </table> </body> </html>

    Read the article

  • FOSUserBundle override mapping to remove need for username

    - by musoNic80
    I want to remove the need for a username in the FOSUserBundle. My users will login using an email address only and I've added real name fields as part of the user entity. I realised that I needed to redo the entire mapping as described here. I think I've done it correctly but when I try to submit the registration form I get the error: "Only field names mapped by Doctrine can be validated for uniqueness." The strange thing is that I haven't tried to assert a unique constraint to anything in the user entity. Here is my full user entity file: <?php // src/MyApp/UserBundle/Entity/User.php namespace MyApp\UserBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity * @ORM\Table(name="depbook_user") */ class User extends BaseUser { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length=255) * * @Assert\NotBlank(message="Please enter your first name.", groups={"Registration", "Profile"}) * @Assert\MaxLength(limit="255", message="The name is too long.", groups={"Registration", "Profile"}) */ protected $firstName; /** * @ORM\Column(type="string", length=255) * * @Assert\NotBlank(message="Please enter your last name.", groups={"Registration", "Profile"}) * @Assert\MaxLength(limit="255", message="The name is too long.", groups={"Registration", "Profile"}) */ protected $lastName; /** * @ORM\Column(type="string", length=255) * * @Assert\NotBlank(message="Please enter your email address.", groups={"Registration", "Profile"}) * @Assert\MaxLength(limit="255", message="The name is too long.", groups={"Registration", "Profile"}) * @Assert\Email(groups={"Registration"}) */ protected $email; /** * @ORM\Column(type="string", length=255, name="email_canonical", unique=true) */ protected $emailCanonical; /** * @ORM\Column(type="boolean") */ protected $enabled; /** * @ORM\Column(type="string") */ protected $salt; /** * @ORM\Column(type="string") */ protected $password; /** * @ORM\Column(type="datetime", nullable=true, name="last_login") */ protected $lastLogin; /** * @ORM\Column(type="boolean") */ protected $locked; /** * @ORM\Column(type="boolean") */ protected $expired; /** * @ORM\Column(type="datetime", nullable=true, name="expires_at") */ protected $expiresAt; /** * @ORM\Column(type="string", nullable=true, name="confirmation_token") */ protected $confirmationToken; /** * @ORM\Column(type="datetime", nullable=true, name="password_requested_at") */ protected $passwordRequestedAt; /** * @ORM\Column(type="array") */ protected $roles; /** * @ORM\Column(type="boolean", name="credentials_expired") */ protected $credentialsExpired; /** * @ORM\Column(type="datetime", nullable=true, name="credentials_expired_at") */ protected $credentialsExpiredAt; public function __construct() { parent::__construct(); // your own logic } /** * @return string */ public function getFirstName() { return $this->firstName; } /** * @return string */ public function getLastName() { return $this->lastName; } /** * Sets the first name. * * @param string $firstname * * @return User */ public function setFirstName($firstname) { $this->firstName = $firstname; return $this; } /** * Sets the last name. * * @param string $lastname * * @return User */ public function setLastName($lastname) { $this->lastName = $lastname; return $this; } } I've seen various suggestions about this but none of the suggestions seem to work for me. The FOSUserBundle docs are very sparse about what must be a very common request.

    Read the article

  • Submitting a URL into a Form without "http://", with "www.", or with neither

    - by John
    (EDITED) Hello, In the form below, the filed for <div class="urlfield"><input name="url" type="url" id="url" maxlength="500"></div> fine when a URL is submitted that has a "http://" at the beginning of it. However, it doesn't work if a URL is submitted with only a "www." in front of it, or with neither a "http://" nor a "www." How can I make it work in all if the submitted URL has any or none of the following at the beginning of it: http:// www. http://www. Thanks in advance, John Form: echo '<div class="submittitle">Submit an item.</div>'; echo '<form action="http://www...com/.../submit2.php" method="post"> <input type="hidden" value="'.$_SESSION['loginid'].'" name="uid"> <div class="submissiontitle"><label for="title">Story Title:</label></div> <div class="submissionfield"><input name="title" type="title" id="title" maxlength="1000"></div> <div class="urltitle"><label for="url">Link:</label></div> <div class="urlfield"><input name="url" type="url" id="url" maxlength="500"></div> <div class="submissionbutton"><input name="submit" type="submit" value="Submit"></div> </form> '; submit2.php: <?php if($_SERVER['REQUEST_METHOD'] == "POST"){header('Location: http://www...com/.../submit2.php');} require_once "header.php"; if (isLoggedIn() == true) { $remove_array = array('http://www.', 'http://', 'https://', 'https://www.', 'www.'); $cleanurl = str_replace($remove_array, "", $_POST['url']); $cleanurl = strtolower($cleanurl); $cleanurl = preg_replace('/\/$/','',$cleanurl); $cleanurl = stripslashes($cleanurl); $title = $_POST['title']; $uid = $_POST['uid']; $title = mysql_real_escape_string($title); $title = stripslashes($title); $cleanurl = mysql_real_escape_string($cleanurl); $site1 = 'http://' . $cleanurl; $displayurl = parse_url($site1, PHP_URL_HOST); function isURL($url1 = NULL) { if($url1==NULL) return false; $protocol = '(http://|https://)'; $allowed = '[-a-z0-9]{1,63}'; $regex = "^". $protocol . // must include the protocol '(' . $allowed . '\.)'. // 1 or several sub domains with a max of 63 chars '[a-z]' . '{2,6}'; // followed by a TLD if(eregi($regex, $url1)==true) return true; else return false; } if(isURL($site1)==true) mysql_query("INSERT INTO submission VALUES (NULL, '$uid', '$title', '$cleanurl', '$displayurl', NULL)"); else echo "<p class=\"topicu\">Not a valid URL.</p>\n"; } else { show_loginform(); } if (!isLoggedIn()) { if (isset($_POST['cmdlogin'])) { if (checkLogin($_POST['username'], $_POST['password'])) { show_userbox(); } else { echo "Incorrect Login information !"; show_loginform(); } } else { show_loginform(); } } else { show_userbox(); } require_once "footer.php"; ?>

    Read the article

  • Rails controller method going to plural form

    - by Jty.tan
    I'm new to rails! Ok, I am trying to set up a user signup form. It is mapped as a singular resource in the routes map.resource :user And trying to create the user through the console works fine. the controller code for user's signup is as follows: def signup @user = User.new#(params[:user]) end def create @user = User.new(params[:user]) #debugger if request.post? if @user.save session[:user] = User.authenticate(@user.login, @user.password) flash[:message] = "Signup successful" redirect_to registries_path else flash[:warning] = "Signup unsuccessful" #redirect_to 'user/signup' end end end The signup view is as follows (and this is where i think something is going wrong) <% form_tag user_path do %> <p>User creation.</p> <p><%= error_messages_for 'user' %></p> <p> <label>Username:</label> <%= text_field_tag 'login', nil, :size => 20, :maxlength => 20 %> </p> <p> <label>Password:</label> <%= password_field_tag 'password', nil, :size => 20, :maxlength => 20 %> </p> <p> <label>Password confirmation:</label> <%= password_field_tag 'password_confirmation', nil, :size => 20, :maxlength => 20 %> </p> <p> <label>Email:</label> <%= text_field_tag 'email' %> </p> <p><%= submit_tag 'Signup' %></p> <% end %> Now, that page renders just fine. I've called the form on the "user_path" which is singular (i think?). But when I hit the submit button, it gives me an error saying that uninitialized constant UsersController the occurence of the error makes sense, since User is meant to be singular, so if it is trying to call the Users controller, it should be chucking an error. When I checked the server log, it shows this message: Processing ApplicationController#create (for 127.0.0.1 at 2010-05-08 16:26:14) [POST] Parameters: {"commit"=>"Signup", "password_confirmation"=>"[FILTERED]", "action"=>"create", "authenticity_token"=>"yOcHY+rMjaqmu9HS8EwnDqJKbc0Zxictc0y4dtD26ac=", "controller"=>"users", "login"=>"bob", "password"=>"[FILTERED]", "email"=>"[email protected]"} NameError (uninitialized constant UsersController): In the params, I can see that it is calling the "users" controller. But I'm not sure how to fix that, or what is causing it to call the "users" controller as opposed to the "user" controller. Any ideas? Thanks in advance!

    Read the article

  • An open plea to Microsoft to fix the serializers in WCF.

    - by Scott Wojan
    I simply DO NOT understand how Microsoft can be this far along with a tool like WCF and it STILL tout it as being an "Enterprise" tool. For example... The following is a simple xsd schema with a VERY simple data contract that any enterprise would expect an "enterprise system" to be able to handle: <?xml version="1.0" encoding="utf-8"?> <xs:schema id="Sample"     targetNamespace="http://tempuri.org/Sample.xsd"     elementFormDefault="qualified"     xmlns="http://tempuri.org/Sample.xsd"     xmlns:mstns="http://tempuri.org/Sample.xsd"     xmlns:xs="http://www.w3.org/2001/XMLSchema">    <xs:element name="SomeDataElement">     <xs:annotation>       <xs:documentation>This documents the data element. This sure would be nice for consumers to see!</xs:documentation>     </xs:annotation>     <xs:complexType>       <xs:all>         <xs:element name="Description" minOccurs="0">           <xs:simpleType>             <xs:restriction base="xs:string">               <xs:minLength value="0"/>               <xs:maxLength value="255"/>             </xs:restriction>           </xs:simpleType>         </xs:element>       </xs:all>       <xs:attribute name="IPAddress" use="required">         <xs:annotation>           <xs:documentation>Another explanation!  WOW!</xs:documentation>         </xs:annotation>         <xs:simpleType>           <xs:restriction base="xs:string">             <xs:pattern value="(([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([1-9]?[0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"/>           </xs:restriction>         </xs:simpleType>       </xs:attribute>     </xs:complexType>  </xs:element>   </xs:schema>  An minimal example xml document would be: <?xml version="1.0"encoding="utf-8" ?> <SomeDataElementxmlns="http://tempuri.org/Sample.xsd" IPAddress="1.1.168.10"> </SomeDataElement> With the max example being:  <?xml version="1.0"encoding="utf-8" ?> <SomeDataElementxmlns="http://tempuri.org/Sample.xsd" IPAddress="1.1.168.10">  <Description>ddd</Description> </SomeDataElement> This schema simply CANNOT be exposed by WCF.  Let's list why:  svcutil.exe will not generate classes for you because it can't read an xsd with xs:annotation. Even if you remove the documentation, the DataContractSerializer DOES NOT support attributes so IPAddress would become an element this not meeting the contract xsd.exe could generate classes but it is a very legacy tool, generates legacy code, and you still suffer from the following issues: NONE of the serializers support emitting of the xs:annotation documentation.  You'd think a consumer would really like to have as much documentation as possible! NONE of the serializers support the enforcement of xs:restriction so you can forget about the xs:minLength, xs:maxLength, or xs:pattern enforcement. Microsoft... please, please, please, please look at putting the work into your serializers so that they support the very basics of designing enterprise data contracts!!

    Read the article

  • ASP MVC2 model binding issue on POST

    - by Brandon Linton
    So I'm looking at moving from MVC 1.0 to MVC 2.0 RTM. One of the conventions I'd like to start following is using the strongly-typed HTML helpers for generating controls like text boxes. However, it looks like it won't be an easy jump. I tried migrating my first form, replacing lines like this: <%= Html.TextBox("FirstName", Model.Data.FirstName, new {maxlength = 30}) %> ...for lines like this: <%= Html.TextBoxFor(x => x.Data.FirstName, new {maxlength = 30}) %> Previously, this would map into its appropriate view model on a POST, using the following method signature: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Registration(AccountViewInfo viewInfo) Instead, it currently gets an empty object back. I believe the disconnect is in the fact that we pass the view model into a larger aggregate object that has some page metadata and other fun stuff along with it (hence x.Data.FirstName instead of x.FirstName). So my question is: what is the best way to use the strongly-typed helpers while still allowing the MVC framework to appropriately cast the form collection to my view-model as it does in the original line? Is there any way to do it without changing the aggregate type we pass to the view? Thanks!

    Read the article

  • XML Schema to restrict one field based on another

    - by Kevin Albrecht
    I have the following schema, which I use to ensure that a person's PhoneNumber and PhoneNumberType (Home, Work, etc.) is not longer than 10 characters. However, I want to improve this schema so that PhoneNumberType is not required if a PhoneNumber is not provided, but is required if the PhoneNumber is provided. Is there a way to do this in XML Schema 1.0? <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xs:element name="PhoneNumber"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="0"/> <xs:maxLength value="10"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="PhoneNumberType"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="0"/> <xs:maxLength value="10"/> </xs:restriction> </xs:simpleType> </xs:element> </xsd:schema>

    Read the article

  • ASP.NET required field validator firing on focus in Firefox

    - by ren33
    I have 2 asp.net textboxes in an update panel. Both textbox controls have some javascript attached to autotab to the next field and to allow only numeric input. When I enter some data into the first field and press enter, focus shifts to the next field and the requiredfieldvalidator of the second field displays its "* required" error message, even though I've just entered the field. This is only happening in Firefox. How can I prevent the validator from firing when I first enter the textbox? edit Here's the code: <asp:TextBox ID="add_ISBN" runat="server" Columns="14" MaxLength="17" CssClass="focus" /> <asp:TextBox ID="add_Qty" runat="server" Columns="4" MaxLength="4" /> <asp:RequiredFieldValidator ID="rfvQty" ControlToValidate="add_Qty" ErrorMessage="* required" ForeColor="Red" Display="Dynamic" EnableClientScript="true" ValidationGroup="Add" runat="server" /> In the codebehind: add_ISBN.Attributes.Add("onkeydown", "return isbnCheck(event, '" & add_Qty.ClientID & "')") And the javascript: function isbnCheck(e, id) { e = e || window.event; var key = e.which || e.keyCode if (validIsbnChars.indexOf(parseInt(key, 10)) >= 0) { return true; } else { if (key == 13) { var nextfield = document.getElementById(id); if (nextfield) nextfield.focus(); return false; } if (e.preventDefault) e.preventDefault(); e.returnValue = false; return false; } } The javascript allows only a valid subset of characters, and if the user presses enter, sets focus to the next field.

    Read the article

  • Set predefine form value (webbrowser control)

    - by Khou
    Hi I want to load my windows form: web browser thats using the webbrowser control, It would load a web page, and load my defination and search for elements that has been define, it will then assign the default values and these values can not be changed by the end user. Example If my application finds "FirstName" it would always assign the value "John" If my application finds "LastName" it would always assign the value "Smith" (these values should not be changed by the end user). Here's how to do it in HTML/JAVASCRIPT, but how do i do this in a windows form? 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

  • iphone encryption not working

    - by Futur
    I have this encryption/decryption implemented and executes with no error, but i am unable to decrypt the data and im not sure whether the data is encrypted, kindly help. - (NSData *)AES256EncryptWithKey:(NSString *)key { char keyPtr[kCCKeySizeAES256+1]; bzero(keyPtr, sizeof(keyPtr)); [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; NSUInteger dataLength = [strData length]; data = [[NSData alloc] init]; data = [strData dataUsingEncoding:NSUTF8StringEncoding]; size_t bufferSize = dataLength + kCCBlockSizeAES128; void *pribuffer = malloc(bufferSize); size_t numBytesEncrypted = 0; CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, keyPtr, kCCKeySizeAES256, NULL /* initialization vector (optional) */, [data bytes], dataLength, /* input */ [data bytes], bufferSize, /* output */ &numBytesEncrypted); if (cryptStatus == kCCSuccess) { return [NSData dataWithBytesNoCopy:data length:numBytesEncrypted]; }} The decryption is : -(NSData *)AES256DecryptWithKey:(NSString *)key andForData:(NSData *)objDataObject { char keyPtr[kCCKeySizeAES256+1]; bzero(keyPtr, sizeof(keyPtr)); [key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding]; NSUInteger dataLength = [objDataObject length]; size_t bufferSize = dataLength + kCCBlockSizeAES128; void *buffer = malloc(bufferSize); size_t numBytesDecrypted = 0; CCCryptorStatus cryptStatus = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding, keyPtr, kCCKeySizeAES256, NULL, [objDataObject bytes], dataLength, [objDataObject bytes], bufferSize, &numBytesDecrypted); if (cryptStatus == kCCSuccess) { return [NSData dataWithBytesNoCopy:objDataObject length:numBytesDecrypted]; } } i call the above methods like this: CryptoClass *obj = [CryptoClass new]; NSData *objData = [obj AES256EncryptWithKey:@"hell"]; NSData *val = [obj AES256DecryptWithKey:@"hell" andForData:objData ]; NSLog(@"decrypted string is : %@ AND LENGTH IS %d",[val description],[val length]); Decryption doesnt seem to happen at all and the encryption - i am not sure about it, kindly help me here.

    Read the article

  • php - correct search expression for bbpress

    - by billn
    I have a very purdy styled search box in my wordpress install, and looking for continuity I want the same for my bbpress forum - currently I'm failing. For WP I have: <div id="search"> <form action="<?php bloginfo('home') ?>" method="get"> <div class="hiddenFields"></div> <p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p></form> </div> For bbPress The form 'method="get"' gets kicked out and of-course I need another expression. bbpress generally seems to use: <div class="search"><?php search_form(); ?></div> This wrecks everything - I get no styling attributes at all other than position... I can make it look fine (and consistent) with by removing the - but then it's obviously just a dummy with no search - any ideas to fix the latter? Thanks <div id="search"> <div class="hiddenFields"></div> <p><input name="s" id="s" maxlength="100" size="18" /><input class="submit" id="submit-button" type="submit" value="submit" /></p> </div>

    Read the article

  • How can I display multiple django modelformset forms in a grouped fieldsets?

    - by JT
    I have a problem with needing to provide multiple model backed forms on the same page. I understand how to do this with single forms, i.e. just create both the forms call them something different then use the appropriate names in the template. Now how exactly do you expand that solution to work with modelformsets? The wrinkle, of course, is that each 'form' must be rendered together in the appropriate fieldset. For example I want my template to produce something like this: <fieldset> <label for="id_base-0-desc">Home Base Description:</label> <input id="id_base-0-desc" type="text" name="base-0-desc" maxlength="100" /> <label for="id_likes-0-icecream">Want ice cream?</label> <input type="checkbox" name="likes-0-icecream" id="id_likes-0-icecream" /> </fieldset> <fieldset> <label for="id_base-1-desc">Home Base Description:</label> <input id="id_base-1-desc" type="text" name="base-1-desc" maxlength="100" /> <label for="id_likes-1-icecream">Want ice cream?</label> <input type="checkbox" name="likes-1-icecream" id="id_likes-1-icecream" /> </fieldset> I am using a loop like this to process the results (after form validation) base_models = base_formset.save(commit=False) like_models = like_formset.save(commit=False) for base_model, likes_model in map(None, base_models, likes_models): which works as I'd expect (I'm using map because the # of forms can be different). The problem is that I can't figure out a way to do the same thing with the templating engine. The system does work if I layout all the base models together then all the likes models after wards, but it doesn't meet the layout requirements. EDIT: Updated the problem statement to be more clear about what exactly I'm processing (I'm processing models not forms in the for loop)

    Read the article

  • How to append text in php

    - by user225269
    I have this form for inputting the birthday in html. But I only have a single column for storing it in wampserver(Column Birthday). <select title="- Select Month -" name="mm" id="mm" class="" > <option value="" SELECTED >Month</option> <option value="1" >Jan</option> <option value="2" >Feb</option> <option value="3" >Mar</option> <option value="4" >Apr</option> <option value="5" >May</option> <option value="6" >Jun</option> <option value="7" >Jul</option> <option value="8" >Aug</option> <option value="9" >Sep</option> <option value="10" >Oct</option> <option value="11" >Nov</option> <option value="12" >Dec</option> </select> <input title="Day" type="text" onkeypress="return isNumberKey(event)" name="dd" value="" size="1" maxlength="2" id='numbers'/ > <input title="Year" type="text" onkeypress="return isNumberKey(event)" name="yyyy" value="" size="1" maxlength="4" id='numbers'/> </td> Do you have any idea on how I can place those 3 values in the same column?Please help

    Read the article

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

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

    Read the article

  • How to MakeTable ReadOnly including contents like images

    - by GustlyWind
    I have a table which has two text boxes and a image beside it to click and open a popup. In read-only mode based on condition I am able to make text boxes read-only but images are not becoming read-only.One solution I had is the anchor tag associated with image calls for JavaScript where I can check for a dummy click when it is in read-only mode. The problem here is the function is common and effects everywhere. So is there a way to make the entire table read-only so that no extra workaround needs to done. Edited for code <table> <tr> <td class="lightbg" colspan='4'>&nbsp; Expires:<input type="TEXT" value="" id="element1" name="expireDate" size="10" maxlength="20" class="" onChange="javascript:validateDateEntry('element1',true);;"> Period:<input type="TEXT" value="" id="element2" name="refershDate" size="10" maxlength="20" class="" onChange="javascript:validateDateEntry('element2',true);;"> &nbsp; <a href="javascript:doCalendar('element1');"> <img src="/PWM/images/images_2006/calendarbtn.gif" border="0" alt="Click to select date from calendar" align="absmiddle"> </a> </td> </tr> <tr> <td colspan='4'><b>*</b>Times are in the WFM Server's Time Zone.</td></tr> </table> Thanks

    Read the article

  • jQuery Character Counter Inside Newly Created Tooltip

    - by Dodinas
    Hello all, I'm having a difficult time figuring this one out. I'm attempting to have a user open a tooltip (using jQuery qTip). What this does is create a "new" tooltip element on the page; it takes it from an existing hidden HTML div on the webpage. Once this new tooltip is created, it has a character counter that is supposed to dynamically update as the user types in the textbox (which is inside the tooltip). The "Max Length Character Counter" script can be found here. However, the "counter" portion is not working inside the newly created tooltip. Any ideas how I can bind this max length character counter to the tooltip? Here's what I'm working with so far: function load_qtip(apply_qtip_to) { $(apply_qtip_to).each(function(){ $(this).qtip({ content: $(".tooltip-contents"), //this is a DIV in the HTML show: 'click', hide: 'unfocus' }); }); } $(document).ready(function() { load_qtip(".tooltip"); $('.my_textbox').maxlength({ 'feedback' : '.my_counter' }); }); And here's what the HTML basically looks like (remember, though, this entire div is "replicated" into a new tooltip): <div class="tooltip_contents"> <form> <div class="my_counter" id="counter">55</div> <textarea class="my_textbox" maxlength="55" id="textbox"></textarea> <input type="button" value="Submit"> </form> </div> Any direction/suggestions on this would be great, as I am completely lost. Thanks very much!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >