Search Results

Search found 3286 results on 132 pages for 'arthur br'.

Page 38/132 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Checking form input data on submit with pure PHP [migrated]

    - by Leron
    I have some experience with PHP but I have never even try to do this wit pure PHP, but now a friend of mine asked me to help him with this task so I sat down and write some code. What I'm asking is for opinion if this is the right way to do this when you want to use only PHP and is there anything I can change to make the code better. Besides that I think the code is working at least with the few test I made with it. Here it is: <?php session_start(); // define variables and initialize with empty values $name = $address = $email = ""; $nameErr = $addrErr = $emailErr = ""; $_SESSION["name"] = $_SESSION["address"] = $_SESSION["email"] = ""; $_SESSION["first_page"] = false; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Missing"; } else { $_SESSION["name"] = $_POST["name"]; $name = $_POST["name"]; } if (empty($_POST["address"])) { $addrErr = "Missing"; } else { $_SESSION["address"] = $_POST["address"]; $address = $_POST["address"]; } if (empty($_POST["email"])) { $emailErr = "Missing"; } else { $_SESSION["email"] = $_POST["email"]; $email = $_POST["email"]; } } if ($_SESSION["name"] != "" && $_SESSION["address"] != "" && $_SESSION["email"] != "") { $_SESSION["first_page"] = true; header('Location: http://localhost/formProcessing2.php'); //echo $_SESSION["name"]. " " .$_SESSION["address"]. " " .$_SESSION["email"]; } ?> <DCTYPE! html> <head> <style> .error { color: #FF0000; } </style> </head> <body> <form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Name <input type="text" name="name" value="<?php echo htmlspecialchars($name);?>"> <span class="error"><?php echo $nameErr;?></span> <br /> Address <input type="text" name="address" value="<?php echo htmlspecialchars($address);?>"> <span class="error"><?php echo $addrErr;?></span> <br /> Email <input type="text" name="email" value="<?php echo htmlspecialchars($email);?>"> <span class="error"><?php echo $emailErr;?></span> <br /> <input type="submit" name="submit" value="Submit"> </form> </body> </html>

    Read the article

  • asp.net mvc radioButtonFor in forEach

    - by George
    Does anyone know why this isn't working? any source code changes would be great. <% foreach (var i in Model.talentImages) { %> <div style="padding:15px;"> <img src="<%: i.uri %>" width="95" height="84" alt="" style="float:left; padding:0px 20px 0px 0px" /> <div style="padding:30px 10px 10px 10px"> <%: Html.RadioButtonFor("group-" + i.uriId.ToString(), i.isApproved)%> Approved <br /> <%: Html.RadioButtonFor("group-" + i.uriId.ToString(), i.isApproved)%> Deny <br /> </div> <hr width="0"/> <%= Html.RadioButton("isProfileePicGroup", i.isProfilePic, false)%> Make Profile Picture <br /> </div> <hr /> <%} %>

    Read the article

  • cannot load JSTL taglib within embedded Jetty server

    - by fthompson
    I am writing a web application that runs within an embedded Jetty instance. When I attempt to execute a JSTL statement, I receive the following exception: org.apache.jasper.JasperException: /index.jsp(1,63) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application I have the following jars on the classpath ant-1.6.5.jar ant-1.7.1.jar ant-launcher-1.7.1.jar core-3.1.1.jar jetty-6.1.22.jar jetty-util-6.1.22.jar jsp-2.1-6.1.14.jar jsp-api-2.1.jar jstl-1.2.jar servlet-api-2.5-20081211.jar servlet-api-2.5-6.1.14.jar standard-1.1.2.jar My web.xml looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee h77p://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>test</display-name> </web-app> My code looks like this: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <body> <h2>Hello World!</h2> <%= new java.util.Date() %><br/> ${1+2}<br/> <c:out var="${5+9}"/><br/> </body> </html> I started my embedded Jetty server like this: Server server = new Server(80); WebAppContext context = new WebAppContext("pig-1.0-SNAPSHOT.war","/"); server.addHandler(context); server.start(); I spent the past two days experimenting with various combinations of jar files, web.xml configurations, and tag library declarations, but to no avail. How can I get an embedded Jetty server up and running with full JSTL support?

    Read the article

  • How to do MEMCACHE in WAMP server WINDOWS XP

    - by Kamal Challa
    Hi Iam running WAMP server and just enabled php_memcache extension and have tried the code <?php $memcache = new Memcache; $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion(); echo "Server's version: ".$version."<br/>\n"; $tmp_object = new stdClass; $tmp_object->str_attr = 'test'; $tmp_object->int_attr = 123; $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server"); echo "Store data in the cache (data will expire in 10 seconds)<br/>\n"; $get_result = $memcache->get('key'); echo "Data from the cache:<br/>\n"; var_dump($get_result); ?> and i got the following error Notice: Memcache::connect() [memcache.connect]: Server localhost (tcp 11211) failed with: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) in C:\wamp\www\memcache\test1.php on line 4 Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) in C:\wamp\www\memcache\test1.php on line 4 Could not connect

    Read the article

  • Tricky CSS Layout

    - by Meep3D
    So I am making a website with quite a problematic layout. There are four corner images TL, TR, BL and BR indicated by black blocks. The dark orange area is the main content (to a width of 960px), with the outside area denoted by the green arrow as the browser window. See diagram: The top image represents the site at its narrowest possible - it shouldn't be allowed to be narrower than this (960px) if it is larger than the defined area there should be no scrollbars. The bottom two images represent different widths of browser. The bottom left and right black blocks (images) should be at the bottom left and right of the screen at all times, unless the width falls to 960px, in which case the BL and BR images should poke into the main area slightly. If the site is shrunk to, say 200px, the BR image should not still be poking in the right corner. At this point I don't really care about it working exactly in IE6 (I can get it roughly working) but I can't even figure out how to do it fully without Javascript or extremely experimental CSS. Currently I am using absolutely positioned div's which sort of work, but don't work quite right. I think I'd be willing to accept a bit of JS if there is no other way but I'd rather not. Answer very appreciated!

    Read the article

  • Primefaces, JavaScript, and JSF does not work well together or am I doing something wrong

    - by Harry Pham
    Here is something so simple <p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/> <input id="tom"/> When u click on the Tom, the textbox get focus. Great, now try this <p:commandLink value="Tom" onclick="document.getElementById('tom').focus()"/><br/> <h:inputText id="tom"/> <br/> when I click nothing happen, I check firebug, I see document.getElementById("tom") is null When I try to use jQuery $('#tom').focus(), nothing happen, no error, but did not get focus either. This is the response (not sure if this is the response from the server) when I see from firebug <?xml version="1.0" encoding="utf-8"?> <partial-response> <changes> <update id="javax.faces.ViewState"><![CDATA[455334589763307998:-2971181471269134244]]></update> </changes> <extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension> </partial-response>

    Read the article

  • Height of a html window's content (not just the viewport height)

    - by gatapia
    Hi All, I'm trying to get the height of a html window's content. This is the full height of the content not the visible height. I have had some (very limited) success using: document.getElementsByTagName('html')[0].offsetHeight in FireFox. This however fails in IEs and it fails in Chrome when using absolute positioned elements (http://code.google.com/p/chromium/issues/detail?id=38999). A sample html file that can be used to reproduce this is: <html> <head> <style> div { border:solid 1px red; height:2000px; width:400px; } .broken { position:absolute; top:0; left:0; } .fixed { position:relative; top:0; left:0; } </style> <script language='javascript'> window.onload = function () { document.getElementById('window.height').innerHTML = window.innerHeight; document.getElementById('window.screen.height').innerHTML = window.screen.height; document.getElementById('document.html.height').innerHTML = document.getElementsByTagName('html')[0].offsetHeight; } </script> </head> <body> <div class='fixed'> window.height: <span id='window.height'>&nbsp;</span> <br/> window.screen.height: <span id='window.screen.height'></span> <br/> document.html.height: <span id='document.html.height'></span> <br/> </div> </body> </html> Thanks All Guido Tapia

    Read the article

  • Changes in resolving .resx in Visual Studio 2010?

    - by MADMap
    Hi, I'm working on a quite simple Webpage (MVC2), using localisation based on ResourceFiles. I have the MVC2 Project and the Resources in a seperate Assembly. The Resources contains 3 languages (Resource.resx, Resource.de.resx, Resource.en.resx, Resource.ja.resx) and I'm querying them via the ResourceManager. Call from the .aspx <% Resources.Res resman = new Resources.Res(); %> <%=resman.GetString("String1", new System.Globalization.CultureInfo("en")) %><br /> <%=resman.GetString("String1", new System.Globalization.CultureInfo("ja")) %><br /> <%=resman.GetString("String1", new System.Globalization.CultureInfo("de")) %><br /> ResourceManager: public class Res { private readonly ResourceManager Manager = Resources.Resource1.ResourceManager; public string GetString(string id, CultureInfo info) { return Manager.GetString(id, info); } } And for the compiled Version in VS2008 I get smth like this: String1EN String1JA String1DE Compiled in Visual Studio 2008, this works fine: but I'm having Troubles if I compile the Solution in Visual Studio 2010 (also 3.5 as TargetFramework). There the result shows smth like: String1DEFAULT String1JA String1DEFAULT I don't know what it can be: is this still a bug from the VS2010 RC or am I doing smth. wrong here?

    Read the article

  • Google's 'go' and scope/functions

    - by danwoods
    In one of the example servers given at golang.org: package main import ( "flag" "http" "io" "log" "template" ) var addr = flag.String("addr", ":1718", "http service address") // Q=17, R=18 var fmap = template.FormatterMap{ "html": template.HTMLFormatter, "url+html": UrlHtmlFormatter, } var templ = template.MustParse(templateStr, fmap) func main() { flag.Parse() http.Handle("/", http.HandlerFunc(QR)) err := http.ListenAndServe(*addr, nil) if err != nil { log.Exit("ListenAndServe:", err) } } func QR(c *http.Conn, req *http.Request) { templ.Execute(req.FormValue("s"), c) } func UrlHtmlFormatter(w io.Writer, v interface{}, fmt string) { template.HTMLEscape(w, []byte(http.URLEscape(v.(string)))) } const templateStr = ` <html> <head> <title>QR Link Generator</title> </head> <body> {.section @} <img src="http://chart.apis.google.com/chart?chs=300x300&cht=qr&choe=UTF- 8&chl={@|url+html}" /> <br> {@|html} <br> <br> {.end} <form action="/" name=f method="GET"><input maxLength=1024 size=70 name=s value="" title="Text to QR Encode"><input type=submit value="Show QR" name=qr> </form> </body> </html> ` Why is template.HTMLEscape(w, []byte(http.URLEscape(v.(string)))) contained within UrlHtmlFormatter? Why can't it be directly linked to "url+html"?

    Read the article

  • Array variable initialization error in Java

    - by trinity
    Hello I am trying to write a Java program that reads an input file consisting of URLs, extracts tokens from these, and keeps track of how many times each token appears in the file. I've written the following code: import java.io.*; import java.net.*; public class Main { static class Tokens { String name; int count; } public static void main(String[] args) { String url_str,host; String htokens[]; URL url; boolean found=false; Tokens t[]; int i,j,k; try { File f=new File("urlfile.txt"); FileReader fr=new FileReader(f); BufferedReader br=new BufferedReader(fr); while((url_str=br.readLine())!=null) { url=new URL(url_str); host=url.getHost(); htokens=host.split("\\.|\\-|\\_|\\~|[0-9]"); for(i=0;i<htokens.length;i++) { if(!htokens[i].isEmpty()) { for(j=0;j<t.length;j++) { if(htokens[i].equals(t[j].name)) { t[j].count++; found=true; } } if(!found) { k=t.length; t[k].name=htokens[i]; t[k].count=1; } } } System.out.println(t.length + "class tokens :"); for(i=0;i<t.length;i++) { System.out.println( "name :"+t[i].name+" frequency :"+t[i].count); } } br.close(); fr.close(); } catch(Exception e) { System.out.println(e); } } } But when I run it, it says: variable t not initialized.. What should I do to set it right?

    Read the article

  • Nested table height in TCPDF

    - by Kuroki Kaze
    Is it possible to make nested table fit height of its parent cell in TCPDF? My code: <?php require_once('tcpdf/config/lang/eng.php'); require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetFont('times', 'BI', 8); $pdf->AddPage(); $pdf->writeHTML('<table> <tr><td bgcolor="gray"> Angoisse et vif espoir, sans humeur factieuse.<br/> Plus allait se vidant le fatal sablier,<br/> Plus ma torture était âpre et délicieuse;<br/> Tout mon coeur s’arrachait au monde familier</td> <td bgcolor="lightgray">Second</td> <td bgcolor="gray">Third</td> <td> <table style="height: 100%"> <tr bgcolor="blue" style="height: 30%"><td bgcolor="yellow" style="height: 30%">Ichi</td></tr> <tr bgcolor="white" style="height: 30%"><td bgcolor="cyan" style="height: 30%">Ni</td></tr> <tr bgcolor="blue" style="height: 30%"><td bgcolor="yellow" style="height: 30%">San</td></tr> </table> </td></tr> </table>'); $pdf->Output('example_002.pdf', 'I'); ?> I want table in last cell to fill it entirely. Is there any way to do this?

    Read the article

  • Refresh User Control without Refreshing the Page

    - by Shrewdy
    hi, I have a page and on that page i have a button and a user control. I want to refresh the user control without refreshing the page. I know i cannot do it otherwise so i did is... (wrapped my user control inside the Update Panel.) <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br /> <asp:Button ID="btnAdd" runat="server" Text="Add name to list" OnClick="btnAdd_Click" /><br /><br /> <asp:UpdatePanel ID="upShowNames" runat="server"> <ContentTemplate> <uc1:ShowNames ID="ucShowNames" runat="server" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnAdd" /> </Triggers> </asp:UpdatePanel> but i still the control wont refresh. i also tried calling the update panels .Update() method by changing its UpdateMode to Conditional but that does not work either... does any one know how can we do it then... any help will be greatly appreciated....thank you!!

    Read the article

  • WebDav And Exchange2007 HTTP1.1 404 Ressource not Found!

    - by adrien
    i have Exchange2007. and i am using the url: "https://exchange2007.exchange.server.com/Exchange/username/calendar"; 'calendar', or 'mailbox'( in your language! example, "boite de reception" in french or "calendário" in portuguese) with that url that i'm using i can list my ressources, but can't send a mail or write an appointement! why?!? See that i get a response of the server 207multistatus and ok, but the return a HTTP/1.1 404 Resource Not Found i wish a 201 created!!! (for my appointement) someone have better ideia ? thx. Console: >>>>>>> to server --------------------------------------------------- PROPPATCH /Exchange/marcelo/calend%C3%A1rio HTTP/1.1 Authorization: Basic bWFyY2Vsb0BleGNoYW5nZTptdXN0YWZhMSQ= Content-Type: text/xml; charset=utf-8 User-Agent: Jakarta Commons-HttpClient/2.0final Host: exchange2007.exchange.snap.com.br Content-Length: 1407 <D:propertyupdate xmlns:D="DAV:"> <D:set> <D:prop> <mapi xmlns="xmlns"> http://schemas.microsoft.com/mapi/ </mapi> <Cmd xmlns="urn:"> saveappt </Cmd> <dtEnd xmlns="urn:schemas:calendar"> 2009-06-30T10:30:00.000Z </dtEnd> <contentclass xmlns="DAV"> urn:content-classes:Appointment </contentclass> <Subject xmlns="urn:schemas:httpmail"> Changed Test Appointment Subject </Subject> <Location xmlns="urn:schemas:calendar"> do </Location> <responserequested xmlns="urn:schemas:calendar"> 0 </responserequested> <saveappt xmlns="urn:schemas:calendar:cmd"> 1 </saveappt> <ressource xmlns="DAV"> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/calendárioassuntoteste.EML </ressource> <alldayevent xmlns="urn:schemas:calendar"> 0 </alldayevent> <to xmlns="urn:schemas:header"> adrien </to> <dtStart xmlns="urn:schemas:calendar"> 2009-06-30T10:00:00.000Z </dtStart> <isfolder xmlns="DAV"> 0 </isfolder> <cmd xmlns="Cmd"> saveappt </cmd> <HtmlDescription xmlns="urn:schemas:httpmail"> Let's meet here </HtmlDescription> <outlookmessageclass xmlns="http://schemas.microsoft.com/exchange/subject-utf8=Appointment"> IPM.Appointement </outlookmessageclass> <instancetype xmlns="urn:schemas:calendar"> 0 </instancetype> <meetingstatus xmlns="urn:schemas:calendar"> CONFIRMED </meetingstatus> <finvited xmlns="urn:schemas:mapi"> 0 </finvited> <BusyType xmlns="urn:schemas:calendar"> BUSY </BusyType> </D:prop> </D:set> </D:propertyupdate> ------------------------------------------------------------------------ <<<<<<< from server --------------------------------------------------- HTTP/1.1 207 Multi-Status Date: Thu, 16 Jul 2009 20:29:40 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET MS-Exchange-Permanent-URL: https://exchange2007.exchange.snap.com.br/Exchange/marcelo/-FlatUrlSpace-/b3ee92320938254c828a96e2e269a417-a6271d Repl-UID: <rid:b3ee92320938254c828a96e2e269a417000000a6282e> Content-Type: text/xml Content-Length: 825 ResourceTag: <rt:b3ee92320938254c828a96e2e269a417000000a6282eb3ee92320938254c828a96e2e269a41700545bb4844c> MS-WebStorage: 08.01.10240 <a:multistatus xmlns:a="DAV:" xmlns:b="xmlns" xmlns:c="urn:" xmlns:d="urn:schemas:calendar" xmlns:e="DAV" xmlns:f="urn:schemas:httpmail" xmlns:g="urn:schemas:calendar:cmd" xmlns:h="urn:schemas:header" xmlns:i="Cmd" xmlns:j="http://schemas.microsoft.com/exchange/subject-utf8=Appointment" xmlns:k="urn:schemas:mapi"> <a:response> <a:href> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/Calend%C3%A1rio </a:href> <a:propstat> <a:status> HTTP/1.1 200 OK </a:status> <a:prop> <b:mapi> </b:mapi> <c:Cmd> </c:Cmd> <d:dtEnd> </d:dtEnd> <e:contentclass> </e:contentclass> <f:Subject> </f:Subject> <d:Location> </d:Location> <d:responserequested> </d:responserequested> <g:saveappt> </g:saveappt> <e:ressource> </e:ressource> <d:alldayevent> </d:alldayevent> <h:to> </h:to> <d:dtStart> </d:dtStart> <e:isfolder> </e:isfolder> <i:cmd> </i:cmd> <f:HtmlDescription> </f:HtmlDescription> <j:outlookmessageclass> </j:outlookmessageclass> <d:instancetype> </d:instancetype> <d:meetingstatus> </d:meetingstatus> <k:finvited> </k:finvited> <d:BusyType> </d:BusyType> </a:prop> </a:propstat> </a:response> </a:multistatus> ------------------------------------------------------------------------ >>>>>>> to server --------------------------------------------------- PROPFIND /Exchange/marcelo/calend%C3%A1rio HTTP/1.1 Authorization: Basic bWFyY2Vsb0BleGNoYW5nZTptdXN0YWZhMSQ= Content-Type: text/xml; charset=utf-8 User-Agent: Jakarta Commons-HttpClient/2.0final Host: exchange2007.exchange.snap.com.br Content-Length: 207 Depth: 0 <D:propfind xmlns:D="DAV:"> <D:prop> <D:displayname> </D:displayname> <D:getcontentlength> </D:getcontentlength> <D:getcontenttype> </D:getcontenttype> <D:resourcetype> </D:resourcetype> <D:getlastmodified> </D:getlastmodified> <D:lockdiscovery> </D:lockdiscovery> </D:prop> </D:propfind> ------------------------------------------------------------------------ <<<<<<< from server --------------------------------------------------- HTTP/1.1 207 Multi-Status Date: Thu, 16 Jul 2009 20:29:40 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Content-Type: text/xml Accept-Ranges: rows MS-WebStorage: 08.01.10240 Transfer-Encoding: chunked <a:multistatus xmlns:a="DAV:" xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" xmlns:c="xml:"> <a:response> <a:href> https://exchange2007.exchange.snap.com.br/Exchange/marcelo/Calend%C3%A1rio/ </a:href> <a:propstat> <a:status> HTTP/1.1 200 OK </a:status> <a:prop> <a:displayname> Calendário </a:displayname> <a:getcontentlength b:dt="int"> 0 </a:getcontentlength> <a:resourcetype> <a:collection> </a:collection> </a:resourcetype> <a:getlastmodified b:dt="dateTime.tz"> 2009-07-16T20:29:40.098Z </a:getlastmodified> <lockdiscovery xmlns="DAV:"> </lockdiscovery> </a:prop> </a:propstat> <a:propstat> <a:status> HTTP/1.1 404 Resource Not Found </a:status> <a:prop> <a:getcontenttype> </a:getcontenttype> </a:prop> </a:propstat> </a:response> </a:multistatus>

    Read the article

  • class array variable initialization error in java

    - by trinity
    Hello I am trying to write a java program that reads an input file consisting of URLs , extracts tokens from these , and accordingly insert into : class Tokens { String name ; int count ; } , where name is the name of every unique token , and count is the frequency of that token in the URLs file..I've written the following code : import java.io.*; import java.net.*; public class Main { static class Tokens { String name; int count; } public static void main(String[] args) { String url_str,host; String htokens[]; URL url; boolean found=false; Tokens t[]; int i,j,k; try { File f=new File("urlfile.txt"); FileReader fr=new FileReader(f); BufferedReader br=new BufferedReader(fr); while((url_str=br.readLine())!=null) { url=new URL(url_str); host=url.getHost(); htokens=host.split("\\.|\\-|\\_|\\~|[0-9]"); for(i=0;i<htokens.length;i++) { if(!htokens[i].isEmpty()) { for(j=0;j<t.length;j++) { if(htokens[i].equals(t[j].name)) { t[j].count++; found=true; } } if(!found) { k=t.length; t[k].name=htokens[i]; t[k].count=1; } } } System.out.println(t.length + "class tokens :"); for(i=0;i<t.length;i++) { System.out.println("name :"+t[i].name+" frequency :"+t[i].count); } } br.close(); fr.close(); } catch(Exception e) { System.out.println(e); } } } But when i run it , it says : variable t not initialized.. What should i do to set it right ?

    Read the article

  • link_to_function toggle problem - Ruby on Rails

    - by bgadoci
    I asked this question back in November and everything seemed to work just fine. I am recently trying to implement it again and running into a problem. I am not receiving any error message, just can't get the toggle to work. Using Rails 2.3.5 and Ruby 1.8.7. See anything wrong here? View <%= javascript_include_tag :defaults %> <div id="comment-toggle"> <%= link_to_function "toggle", "$('comments_#{project.id}').toggle()" %> </div> <div id="comments_<%= project.id %>" class="comments" > <%= render :partial => project.comments %> <% remote_form_for [project, Comment.new] do |f| %> <p> <%= f.label :body, "New Comment" %><br/> <%= f.text_area (:body, :class => "textarea") %> </p> <p> <%= f.label :name, "Name" %> (Required)<br/> <%= f.text_field (:name, :class => "textfield") %> </p> <p> <%= f.label :email, "Email" %> (Required but will not be displayed)<br/> <%= f.text_field (:email, :class => "textfield") %> </p> <p><%= f.submit "Add Comment" %></p> <% end %> </div>

    Read the article

  • javasript function

    - by user289346
    var curtext="View large image"; function changeSrc() { if(curtext == "View large image"){ document.getElementById("boldStuff").innerHTML ="View small image"; curtext="View small image"; } else{ document.getElementById("boldStuff").innerHTML="View large image"; curtext="View large image"; } } var curimage="cottage_small.jpg"; function changeSrc(){ if(curimage == "cottage_small.jpg"){ document.getElementById("myImage").src="cottage_large.jpg"; curimage="cottage_large.jpg"; } else{ document.getElementById("myImage").src="cottage_small.jpg"; curimage="cottage_small.jpg"; } } </script> </head> <body> <!-- Your page here --> <h1> Pink Knoll Properties</h1> <h2> Single Family Homes</h2> <p> Cottage:<strong>$149,000</strong><br/> 2 bed, 1 bath, 1,189 square feet, 1.11 acres <br/><br/> <a href="#" onclick="changeSrc()"><b id="boldStuff" />View large image</a></p> <p><img id="myImage" src="cottage_small.jpg" alt="Photo of a cottage" /></p> </body> I need help, how to put as one function with two arguments. That means when you click, the image and text both will be change. Thank you! Bianca

    Read the article

  • Excel 2007 file writer in C# results in a corrupt file

    - by Martin
    Hi, I am using a BinaryReader to read an Excel 2007 file from an Exchange mailbox using a OWA, the file is then written to disk using a BinaryWriter. My problem is that the two files don't match when the writer finishes. Worse still Excel 2007 won't open the writen file. Previously Excel 2003 has had no problem with the solution below. And Excel 2007 doesn't have an issue if the file is an Excel 2003 format file, only if the file format is Excel 2007 (*.xlsx). BinaryReader: using(System.IO.Stream stream = resource.GetInputStream(attachedFiles[k].Address)) { using(System.IO.BinaryReader br = new System.IO.BinaryReader(stream)) { attachment.Data = new byte[attachedFiles[k].Size]; int bufPosn=0, len=0; while ((len = br.Read( attachment.Data, bufPosn, attachment.Data.Length-bufPosn )) > 0) { bufPosn += len; } br.Close(); } } BinaryWriter: FileStream fs = new FileStream(fileName, FileMode.Create); BinaryWriter binWriter = new BinaryWriter(fs); binWriter.Write( content, 0, content.Length ); binWriter.Close(); fs.Close(); Suggestions gratfully received.

    Read the article

  • String Builder Class in asp.net

    - by Indranil Mutsuddy
    Hiya, Suppose I want to display text retrieved from data base and I want to display the text applying color, font style etc. Is that possible?..Below is a sample code which i 've done recently. SqlDataReader myreader; myreader = cmmd.ExecuteReader(); StringBuilder sb = new StringBuilder(); sb.Append("<b>Vaccine</b>&nbsp;&nbsp;&nbsp;<b> Vaccination Date</b>&nbsp;&nbsp;&nbsp;<b> Vaccination Due Date</b>&nbsp;&nbsp;&nbsp;<b> Incomplete Vaccination </b>&nbsp;&nbsp;&nbsp;<b>Dose No.</b>&nbsp;&nbsp;&nbsp;<b> Remarks </b><br/><br/>"); while (myreader.Read()) { sb.Append(myreader["VaccineID"]); sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); sb.Append(myreader["DateOFVaccine"]); sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); sb.Append(myreader["NextVaccinationDueDate"]); sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); sb.Append(myreader["AnyIncompleteImmunization"]); sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); sb.Append(myreader["DoseNumber"]); sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); sb.Append(myreader["Remark1"]); sb.Append("<br/>"); } lblDisplayDetails.Text = sb.ToString(); myreader.Close(); Thank You

    Read the article

  • Render a Form from an XSLT file

    - by Russ Clark
    I've generated the following XSLT file, and have created a Form that will post to an ASP.Net MVC action called Home/ProcessRequest: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> <xsl:value-of select="Employee/Name"/> <br /> <xsl:value-of select="Employee/ID"/> <form method="post" action="/Home/ProcessRequest?id=42"> <input id="Action" name="Action" type="radio" value="Approved"></input> Approved <br /> <input id="Action" name="Action" type="radio" value="Rejected"></input> Rejected <br /> <input type="submit" value="Submit"></input> </form> </body> </html> Here is my XML File: <Employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Name>Russ</Name> <ID>42</ID> </Employee> This works fine the way it is, but I need to change the id parameter in my from from a hard coded integer, to use the ID element from my XML file. Does anyone know how to do this?

    Read the article

  • Parsing Line Breaks in PHP/JavaScript

    - by Matt G
    I have a text area in my PHP application where users can enter notes in a project. Sometimes this is displayed on the page via PHP and sometimes it is displayed via javascript. The problem is, if the note is across multiple lines (i.e. the user presses enter while entering notes in the text area), it causes the JS to fail. It's fine when it's being done by the PHP. The line of code in question is: var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor"><?php print $notes; ?></textarea>'; So, if the note is over multiple lines, the PHP builds the pager as: var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor">This is a test note over multiple lines </textarea>'; And this obviously causes problems for the js. So my question is, what can I do to prevent this? As the code is being built by PHP before it even gets to the browser, I'm thinking that the best approach may be to parse it in the PHP so that the output is something more like this: var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor">This is<br/>a test note<br/>over multiple lines<br/></textarea>'; Will this work? How would I do it? Thanks

    Read the article

  • How to make this jquery function reusable?

    - by Pandiya Chendur
    Hai this is my jquery function, function getRecordspage(curPage, pagSize) { $.ajax({ type: "POST", url: "Default.aspx/GetRecords", data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(jsonObj) { var strarr = jsonObj.d.split('##'); var jsob = jQuery.parseJSON(strarr[0]); $.each(jsob.Table, function(i, employee) { $('<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>').appendTo('#ResultsDiv'); }); $(".resultsdiv:even").addClass("resultseven"); $(".resultsdiv").hover(function() { $(this).addClass("resultshover"); }, function() { $(this).removeClass("resultshover"); }); } }); } In my page i have this jquery script, $("#lnkbtn0").click(function() { getRecordspage(1, 5) }); And my page has <a ID="lnkbtn0" class="page-numbers">1</a> <a ID="lnkbtn1" class="page-numbers">2</a> <a ID="lnkbtn2" class="page-numbers">3</a> <a ID="lnkbtn3" class="page-numbers">4</a> How to make other link buttons to call this function with diff curPage parameter...

    Read the article

  • NoSuchMethodError in Java using XStream

    - by Brad Germain
    I'm trying to save a database into a file using XStream and then open it again later using XStream and deserialize it back into the objects it was in previously. The database consists of an arraylist of tables, which consists of an arraylist of a data class where the data class contains an arraylist of objects. I'm basically trying to create an sql compiler. I'm currently getting a java.lang.NoSuchMethodError because of the last line in the load method. Here's what I have: Save Method public void save(Database DB){ File file = new File(DB.getName().toUpperCase() + ".xml"); //Test sample DB.createTable("TBL1(character(a));"); DB.tables.getTable("TBL1").rows.add(new DataList()); DB.tables.getTable("TBL1").rows.getRow(0).add(10); XStream xstream = new XStream(); //Database xstream.alias("Database", Database.class); //Tables xstream.alias("Table", Table.class); //Rows xstream.alias("Row", DataList.class); //Data //xstream.alias("Data", Object.class); //String xml = xstream.toXML(DB); Writer writer = null; try { writer = new FileWriter(file); writer.write(xstream.toXML(DB)); writer.close(); } catch (IOException e) { e.printStackTrace(); } } Load Method public void Load(String dbName){ XStream xstream = new XStream(); BufferedReader br; StringBuffer buff = null; try { br = new BufferedReader(new FileReader(dbName + ".xml")); buff = new StringBuffer(); String line; while((line = br.readLine()) != null){ buff.append(line); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } database = (Database)xstream.fromXML(buff.toString()); }

    Read the article

  • Appending html data when item in html select list is selected

    - by Workoholic
    I have a selector that could look like this: <label for="testselector">Test</label><br /> <select id="testselector" name="test[]" size="5" multiple="multiple"> <option name="test_1" value="1">Test Entry X</option> <option name="test_3" value="2">Test Entry Y</option> <option name="test_5" value="5">Test Entry Z</option> </select> <div id="fieldcontainer"></div> When an entry from the above fields is selected, I want two form fields to appear. I use jquery to add them: $("#fieldcontainer").append("<div><label for=\"testurl\">Test Url</label><br /><input name=\"testurl[]\" type=\"text\" id=\"testurl_1\" value=\"\" /></div>"); $("#fieldcontainer").append("<div><label for=\"testpath\">Test Path</label><br /><input name=\"testpath[]\" type=\"text\" id=\"testpath_1\" value=\"\" /></div>"); I can easily add a click handler to make those form fields appear. But how would I keep track of what form fields were already added? When multiple fields are selected, the appropriate number of input fields needs to be added to the fieldcontainer div. And if they are unselected, the input fields need to be removed again. I also need to retrieve the value from the options in the select list to add them as identifier in the added input fields...

    Read the article

  • jQuery Equal Height Divs

    - by griegs
    If i have the following harkup; <div> <div> <div id='sameHeight'>One<br>two<br>three</div> <div id='sameHeight'>four</div> <div id='sameHeight'>five</div> <div> <div> <div id='sameHeight'>four</div> <div id='sameHeight'>six</div> <div id='sameHeight'>seven<br>eight</div> <div> </div> How can I ensure that all divs marked as "sameHeight" are the same height as their counterparts in the other div? I had a look at equalHeights plugin but that assumes all divs side by side are in the same parent. I need one that can either traverse parents or allow me to specify parents. Is there such a thing or do I need to write it?

    Read the article

  • AjaxStart issue

    - by Jerry
    Hi All I am trying to build a shopping website with ajax. When a user clicks the "add to cart" image. The little loading image will show next to the Add To Cart Image. The first click works fine and the image showed as I expected. However, the second and the following clicks appends more images on the first loading image(2nd:add two loading images, 3rd: add three images..6 total images after 3 clicks). I did use ajaxStop and remove the first image...Not sure what's going on...Could use a help. Thanks a lot. My javascript code // add to cart $(".addToCart").click(function(e){ $this=$(this); $tableId=$this.closest('table').attr('id'); $($this).prev().ajaxStart(function(){ $("<img class='loader' src='images/loader.gif'>").insertBefore($this); }); $($this).prev().ajaxStop(function(){ $($this).prev().remove(); }); HTML <table> <tr> <td width="146" align="right" valign="middle"> <br> <span id="wasPrice"><?php echo $productPriceWas; ?></span> <br> <?php echo "$".$productPrice;?><br>**//I want my image here**<a class="addToCart" href="javascript:void(0);"><img src="images/addToCart.gif" alt="add To Cart"/><a/> </td> </tr> </table>

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >