Search Results

Search found 4716 results on 189 pages for 'comment'.

Page 15/189 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • JavaScript to enable "submit" button (doesn't work)

    - by Halst
    I need the button "submit" to be disabled unless JavaScript is on. I tried: 1. <input onLoad="this.disabled=false" id="post-comment" type="submit" value="Post Your Comment" disabled="disabled"/> 2. <input onLoad="this.removeAttribute("disabled");" id="post-comment" type="submit" value="Post Your Comment" disabled="disabled"/> 3. <input onLoad="document.getElementById("post-comment").removeAttribute("disabled");" id="post-comment" type="submit" value="Post Your Comment" disabled="disabled"/> Doesn't work. I'm new to JavaScript, but can't find answer on the net.

    Read the article

  • How can I embed a conditional comment for IE with innerHTML?

    - by Samuel Charpentier
    Ok so I want to conditionally add this line of code; <!--[if ! IE]> <embed src="logo.svg" type="image/svg+xml" /> <![endif]--> Using: document.getElementById("logo") .innerHTML='...'; In a if()/else() statement and it don't write it! If i get rid of the selective comment ( <!--[if ! IE]><![endif]-->) and only put the SVG ( <embed src="logo.svg" type="image/svg+xml" /> ) it work! what should I do? I found a way around but i think in the Android browser the thing will pop up twice. here's what I've done ( and its Validated stuff!); <!DOCTYPE html> <html> <head> <META CHARSET="UTF-8"> <title>SVG Test</title> <script type="text/javascript"> //<![CDATA[ onload=function() { var ua = navigator.userAgent.toLowerCase(); var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); if(isAndroid) { document.getElementById("logo").innerHTML='<img src="fin_palais.png"/>'; } } //]]> </script> </head> <body> <div id="logo"> <!--[if lt IE 9]> <img src="fin_palais.png"/> <![endif]--> <!--[if gte IE 9]><!--> <embed src="fin_palais.svg" type="image/svg+xml" /> <!--<![endif]--> </div> </body>

    Read the article

  • How to extract comment out of header file using python, perl, or sed?

    - by WilliamKF
    I have a header file like this: /* * APP 180-2 ALG-254/258/772 implementation * Last update: 03/01/2006 * Issue date: 08/22/2004 * * Copyright (C) 2006 Somebody's Name here * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef HEADER_H #define HEADER_H /* More comments and C++ code here. */ #endif /* End of file. */ And I wish to extract out the contents of the first C style comment only and drop the " *" at the start of each line to get a file with the following contents: APP 180-2 ALG-254/258/772 implementation Last update: 03/01/2006 Issue date: 08/22/2004 Copyright (C) 2006 Somebody's Name here All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Please suggest an easy way to do this with Python, Perl, sed, or some other way on Unix. Preferably as a one-liner.

    Read the article

  • Loop results executing twice

    - by ozzysmith
    I creating a simple site with PHP where the users can submit blogs and other users (who are logged in) can post comments on them. I have made a link called "comments" below each blog that when clicked will show / hide all the comments relevant to the specific blog (also if the user is logged in, it will show a form field in which they can submit new comments). So basically each blog will have multiple comments. I have done two different codes for this but they both have the same problem that each comment appears twice (everything else works fine). Could anyone point out why? mysql_select_db ("ooze"); $result = mysql_query ("select * from blog") or die(mysql_error()); $i = 1; while($row = mysql_fetch_array($result)) { echo "<h1>$row[title]</h1>"; echo "<p class ='second'>$row[blog_content]</p> "; echo "<p class='meta'>Posted by .... &nbsp;&bull;&nbsp; $row[date] &nbsp;&bull;&nbsp; <a href='#' onclick=\"toggle_visibility('something$i'); return false\">Comments</a><div id='something$i' style='display: none;'>"; $i++; $a = $row["ID"]; $result2 = mysql_query ("select * from blog, blogcomment where $a=blogID") or die(mysql_error()); while($sub = mysql_fetch_array($result2)) { echo "<p class='third' >$sub[commentdate] &nbsp;&bull;&nbsp; $sub[username]</p><p>said:</p> <p>$sub[comment]</p>"; } if ( isset ($_SESSION["gatekeeper"])) { echo '<form method="post" name="result_'.$row["ID"].'" action="postcomment.php"><input name="ID" type = "hidden" value = "'.$row["ID"].'" /><input name="comment" id="comment" type="text" style="margin-left:20px;"/><input type="submit" value="Add comment" /></form>'; } else { echo '<p class="third"><a href="register.html">Signup </a>to post a comment</p>'; } echo "</div>"; } mysql_close($conn); //second version of inner loop:// if ( isset ($_SESSION["gatekeeper"])) { while($sub = mysql_fetch_array($result2)) { echo "<p class='third' >$sub[commentdate] &nbsp;&bull;&nbsp; $sub[username] said:</p> <p>$sub[comment]</p>"; } echo '<form method="post" name="result_'.$row["ID"].'" action="postcomment.php"><input name="ID" type = "hidden" value = "'.$row["ID"].'" /><input name="comment" id="comment" type="text" style="margin-left:20px;"/><input type="submit" value="Add comment" /></form>'; } else { while($sub = mysql_fetch_array($result2)) { echo "<p class='third' >$sub[commentdate] &nbsp;&bull;&nbsp; $sub[username] said:</p> <p>$sub[comment]</p>"; } echo '<p class="third"><a href="register.html">Signup </a>to post a comment</p>'; } echo "</div>"; } mysql_close($conn);

    Read the article

  • Proper Data Structure for Commentable Comments

    - by Wesley
    Been struggling with this on an architectural level. I have an object which can be commented on, let's call it a Post. Every post has a unique ID. Now I want to comment on that Post, and I can use ID as a foreign key, and each PostComment has an ItemID field which correlates to the Post. Since each Post has a unique ID, it is very easy to assign "Top Level" comments. When I comment on a comment however, I feel like I now need a PostCommentComment, which attaches to the ID of the PostComment. Since ID's are assigned sequentially, I can no longer simply use ItemID to differentiate where in the tree the comment is assigned. I.E. both a Post and a Post Comment might have an ID of '5', so my foreign key relationship is invalid. This seems like it could go on infinitely, with PostCommentCommentComment's etc... What's the best way to solve this? Should I have a field in the comment called "IsPostComment" or something of the like to know which collection to attach the ID to? This strikes me as the best solution I've seen so far, but now I feel like I need to make recursive DataBase calls which start to get expensive. Meaning, I get a Post and get all PostComments where ItemID == Post.ID && where IsPostComment == true Then I take that as a collection, gather all the ID's of the PostComments, and do another search where ItemID == PostComment[all].ID && where IsPostComment == false, then repeat infinitely. This means I make a call for every layer, and if I'm calling 100 Posts, I might make 1000 DB calls to get 10 layers of comments each. What is the right way to do this?

    Read the article

  • Ubuntu 13.04 client cannot connect to Raspbian samba share

    - by envoyweb
    I have a client Ubuntu 13.04 machine trying to connect to a server running Raspbian with samba and samba-common-bin installed on the server I can see my share and when I try to login I get this error: Unable to access location: Failed to write windows share Cannot allocate memory. I have installed ntfs-3g for the usb hard drive that already auto mounts on the server so I never had to create a directory or edit fstab. Testparm on the server states the following: [global] workgroup = ENVOYWEB server string = %h server map to guest = Bad User obey pam restrictions = Yes pam password change = Yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%m max log size = 1000 dns proxy = No usershare allow guests = Yes panic action = /usr/share/samba/panic-action %d idmap config * : backend = tdb [homes] comment = Home Directories valid users = %S create mask = 0700 directory mask = 0700 browseable = No [printers] comment = All Printers path = /var/spool/samba create mask = 0700 printable = Yes print ok = Yes browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/printers [BigDude] comment = Sharing BigDude's Files path = /media/BigDude/ valid users = @users read only = No create mask = 0755 testparm on the client which is running ubuntu is as follows [global] workgroup = ENVOYWEB server string = %h server (Samba, Ubuntu) map to guest = Bad User obey pam restrictions = Yes pam password change = Yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%m max log size = 1000 dns proxy = No usershare allow guests = Yes panic action = /usr/share/samba/panic-action %d idmap config * : backend = tdb [printers] comment = All Printers path = /var/spool/samba create mask = 0700 printable = Yes print ok = Yes browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/printers

    Read the article

  • Encoding Special Characters For Outlook HTML Email

    - by n0chi
    I have an asp.net / C# page which takes a comment, and then emails that comment. Sometimes when the user enters "&" in the comment, the comment is being truncated. So for example if the comment is "test & test" the email only sends out "test ". I have tried HttpUtility.HtmlEncode - but it looks like the issue is on the outlook side and not on the C# side.

    Read the article

  • What is the most elegant way to validate the presence of ONLY one out of two attributes using Rails?

    - by marcgg
    class Followup < ActiveRecord::Base belongs_to :post belongs_to :comment end This model needs to only have either a post or a comment, but only one of the two. Here's the rspec for what I'm trying to do: it "should be impossible to have both a comment and a post" do followup = Followup.make followup.comment = Comment.make followup.should be_valid followup.post = Post.make followup.should_not be_valid end I can see a bunch of ways of doing this, but what would be the most elegant way of doing this?

    Read the article

  • Unusual RJS error

    - by rrb
    Hi, I am getting the following error in my RoR application: RJS error: TypeError: element is null Element.update("notice", "Comment Posted"); Element.update("allcomments", "\n\n\n \n\n waht now?\n\n \n\n \n\n \n\n asdfasdfa\n \n\n \n\n asdfasdf\n \n\n\n\n\n"); But when I hit the refresh button, I can see my partial updated. Here's my code: show_comments View: <table> <% comments.each do |my_comment| %> <tr> <td><%=h my_comment.comment%></td> </tr> <% end %> </table> show View: <div class="wrapper"> <div class="rescale"> <div class="img-main"> <%= image_tag @deal.photo.url %> </div> </div> <div class="description"> <p class ="description_content"> <%=h @deal.description %> </p> </div> </div> <p> <b>Category:</b> <%=h @deal.category %> </p> <p> <b>Base price:</b> <%=h @deal.base_price %> </p> <%#*<p>%> <%#*<b>Discount:</b>%> <%#=h @deal.discount %> <%#*</p>%> <%= link_to 'Edit', edit_deal_path(@deal) %> | <%= link_to 'Back', deals_path %> <p> <%= render :partial=>'deal_comments', :locals=>{ :comments=>Comment.new(:deal_id=>@deal.id)} %> </p> <div id="allcomments"> <%= render :partial=>'show_comments', :locals=>{ :comments=>Comment.find(@deal.comments)} %> </div> Controller: def create @comment = Comment.new(params[:comment]) render :update do |page| if @comment.save page.replace_html 'notice', 'Comment Posted' else page.replace_html 'notice', 'Something went wrong' end page.replace_html 'allcomments', :partial=> 'deals/show_comments', :locals=>{:comments=> @comment.deal.comments} end end def show_comments @deal = Deal.find(params[:deal_id]) render :partial=> "deals/show_comments", :locals=>{:comments=>@deal.comments} end end

    Read the article

  • MYSQL UPDATE with IN and Subquery

    - by Johal
    Hi i have tables like this : table entry : id | total_comments ___________ 1 | 0 2 | 0 3 | 0 4 | 0 table comments : id | eid | comment ___________ 1 | 1 | comment sdfd 2 | 1 | testing testing 3 | 1 | comment text 4 | 2 | dummy comment 5 | 2 | sample comment 6 | 1 | fg fgh dfh Query i write : UPDATE entry SET total_comments = total_comments + 1 WHERE id IN ( SELECT eid FROM comments WHERE id IN (1,2,3,4,5,6)) Results i get is : table entry : id | total_comments ___________ 1 | 1 2 | 1 3 | 0 4 | 0 Expected results : table entry : id | total_comments ___________ 1 | 4 2 | 2 3 | 0 4 | 0 Any help will be appreciated.

    Read the article

  • how to use ajax with json in ruby on rails

    - by rafik860
    I am implemeting a facebook application in rails using facebooker plugin, therefore it is very important to use this architecture if i want to update multiple DOM in my page. if my code works in a regular rails application it would work in my facebook application. i am trying to use ajax to let the user know that the comment was sent, and update the comments bloc. migration: class CreateComments < ActiveRecord::Migration def self.up create_table :comments do |t| t.string :body t.timestamps end end def self.down drop_table :comments end end controller: class CommentsController < ApplicationController def index @comments=Comment.all end def create @comment=Comment.create(params[:comment]) if request.xhr? @comments=Comment.all render :json=>{:ids_to_update=>[:all_comments,:form_message], :all_comments=>render_to_string(:partial=>"comments" ), :form_message=>"Your comment has been added." } else redirect_to comments_url end end end view: <script> function update_count(str,message_id) { len=str.length; if (len < 200) { $(message_id).innerHTML="<span style='color: green'>"+ (200-len)+" remaining</span>"; } else { $(message_id).innerHTML="<span style='color: red'>"+ "Comment too long. Only 200 characters allowed.</span>"; } } function update_multiple(json) { for( var i=0; i<json["ids_to_update"].length; i++ ) { id=json["ids_to_update"][i]; $(id).innerHTML=json[id]; } } </script> <div id="all_comments" > <%= render :partial=>"comments/comments" %> </div> Talk some trash: <br /> <% remote_form_for Comment.new, :url=>comments_url, :success=>"update_multiple(request)" do |f|%> <%= f.text_area :body, :onchange=>"update_count(this.getValue(),'remaining');" , :onkeyup=>"update_count(this.getValue(),'remaining');" %> <br /> <%= f.submit 'Post'%> <% end %> <p id="remaining" >&nbsp;</p> <p id="form_message" >&nbsp;</p> <br><br> <br> if i try to do alert(json) in the first line of the update_multiple function , i got an [object Object]. if i try to do alert(json["ids_to_update"][0]) in the first line of the update_multiple function , there is no dialog box displayed. however the comment got saved but nothing is updated. it seems like the object sent by rails is nil or cant be parsed by JSON.parse(json). questions: 1.how can javascript and rails know that i am dealing with json objects?deos ROR sent it a object format or a text format?how can it check that the json object has been sent 2.how can i see what is the returned json?do i have to parse it?how? 2.how can i debug this problem? 3.how can i get it to work?

    Read the article

  • Pass object to dynamically loaded ListView ItemTemplate

    - by mickyjtwin
    I have been following the following post on using multiple ItemTemplates in a ListView control. While following this example does produce output, I am trying ot figure out how to psas an object through to the ItemTemplate's user control, which I do not seem to be able to do/figure out. protected void lvwComments_OnItemCreated(object sender, ListViewItemEventArgs e) { ListViewDataItem currentItem = (e.Item as ListViewDataItem); Comment comment = (Comment)currentItem.DataItem; if (comment == null) return; string controlPath = string.Empty; switch (comment.Type) { case CommentType.User: controlPath = "~/layouts/controls/General Comment.ascx"; break; case CommentType.Official: controlPath = "~/layouts/controls/Official Comment.ascx"; break; } lvwComments.ItemTemplate = LoadTemplate(Controlpath); } The User Control is as follows: public partial class OfficialComment : UserControl { protected void Page_Load(object sender, EventArgs e) { } } In the example, the values are being output in the ascx page: <%# Eval("ItemName") %> however I need to access the ListItem in this control to do other logic. I cannot figure out how I to send through my Comment item. The sender object and EventArgs do not contain the info.

    Read the article

  • radio button to php

    - by Azzyh
    Hello so i have this form: <form action="javascript:DoSCInsert()" method="post"> <textarea onfocus="this.cleared=true;javascript:clearContents(this);" rows="5" cols="40" id="comment" name="comment">...</textarea> Yes: <input type="radio" value="Y" id="SCvoteY" name="vote"></input> No: <input type="radio" id="SCvoteN" value="N" name="vote"> </input> <input type="hidden" name="fID" id="fID" value="<? echo $_GET["id"]; ?>" /> <input onsubmit="if (!this.comment.cleared) clearContent(this.comment); return true;" type="submit" name="Submit" value="Stem!"/> </form> Anyway so i have this javascript also that tranfers the output info to insertSC.php: function DoSCInsert(){ $("#SCres").html("to sek.."); var nocache = '0'; var data = { fID : $("#fID").val(), SCvote : $("#SCvoteY").val(), SCvote : $("#SCvoteN").val(), comment: $("#comment").val(), nocache: nocache }; $.get('insertSC.php', data, onSCInsertComplete); } function onSCInsertComplete(data,textstatus){ $("#SCres").html(data); } and in my insertSC.php i have this: <?php echo $_GET['comment']." - ".$_GET['SCvoteY']; ?> Now i get out comment but no SCvoteY.... this is just a test i made, what i was really making is that you vote Y or N and then it inserts into the vote column Y or N(what you pickd) now i couldnt figure how to do it/something went wrong somewhere and now i cant even get out SCvoteY i just get undefined index What i need help with is what i just mention i want to when you either choose Y or N it should output what you choose. If you didnt choose any (empty isset?) then false.. else echo Y or N(what you picked)

    Read the article

  • jQuery ajax post failing in asp

    - by Dave Kiss
    hey guys, this might be really stupid, but hopefully someone can help. I'm trying to post to an external script using ajax so i can mail the data, but for some reason my data is not making it to the script. $(document).ready(function() { $("#submitContactForm").click(function () { $('#loading').append('<img src="http://www.xxxxxxxx.com/demo/copyshop/images/loading.gif" alt="Currently Loading" id="loadingComment" />'); var name = $('#name').val(); var email = $('#email').val(); var comment = $('#comment').val(); var dataString = 'name='+ name + '&email=' + email + '&comment=' + comment; $.ajax({ url: 'http://www.xxxxx.com/demo/copyshop/php/sendmail.php', type: 'POST', data: '?name=Dave&[email protected]&comment=hiiii', success: function(result) { $('#loading').append('success'); } }); return false; }); }); the php script is simple (for now - just wanted to make sure it worked) <?php $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; $to = '[email protected]'; $subject = 'New Contact Inquiry'; $message = $comment; mail($to, $subject, $message); ?> the jquery is embedded in an .aspx page (a language i'm not familiar with) but is posting to a php script. i'm receiving emails properly but there is no data inside. am i missing something? i tried to bypass the variables in this example, but its still not working thanks

    Read the article

  • Deleting a resource in a Cucumber (Capybara) step doesn't work

    - by Josiah Kiehl
    Here is my Scenario: Scenario: Delete a match Given pojo is logged in And there is a match with the following: | game_id | 1 | | name | Game del Pojo | | date_and_time | 2010-02-23 17:52:00 | | players | 2 | | teams | 2 | | comment | This is an awesome comment | | user_id | 1 | And I am on the show match 1 page And show me the page When I follow "Delete" And I follow "Yes, delete it" Then there should not be a match with the following: | game_id | 1 | | name | Game del Pojo | | date_and_time | 2010-02-23 17:52:00 | | players | 2 | | teams | 2 | | comment | This is an awesome comment | | user_id | 1 | If I walk through these steps manually, they work. When I click the confirmation: Yes, delete it, then the match is deleted. Cucumber, however, fails to delete the record and the last step fails. And I follow "Yes, delete it" # features/step_definitions/web_steps.rb:32 Then there should not be a match with the following: # features/step_definitions/match_steps.rb:8 | game_id | 1 | | name | Game del Pojo | | date_and_time | 2010-02-23 17:52:00 | | players | 2 | | teams | 2 | | comment | This is an awesome comment | | user_id | 1 | <nil> expected but was <#<Match id: 1, name: "Game del Pojo", date_and_time: "2010-02-23 17:52:00", teams: 2, created_at: "2010-03-02 23:06:33", updated_at: "2010-03-02 23:06:33", comment: "This is an awesome comment", players: 2, game_id: 1, user_id: 1>>. (Test::Unit::AssertionFailedError) /usr/lib/ruby/1.8/test/unit/assertions.rb:48:in `assert_block' /usr/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion' /usr/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block' /usr/lib/ruby/1.8/test/unit/assertions.rb:83:in `assert_equal' /usr/lib/ruby/1.8/test/unit/assertions.rb:172:in `assert_nil' ./features/step_definitions/match_steps.rb:22:in `/^there should (not)? be a match with the following:$/' features/matches.feature:124:in `Then there should not be a match with the following:' Any clue how to debug this? Thanks!

    Read the article

  • django join-like expansion of queryset

    - by jimbob
    I have a list of Persons each which have multiple fields that I usually filter what's upon, using the object_list generic view. Each person can have multiple Comments attached to them, each with a datetime and a text string. What I ultimately want to do is have the option to filter comments based on dates. class Person(models.Model): name = models.CharField("Name", max_length=30) ## has ~30 other fields, usually filtered on as well class Comment(models.Model): date = models.DateTimeField() person = models.ForeignKey(Person) comment = models.TextField("Comment Text", max_length=1023) What I want to do is get a queryset like Person.objects.filter(comment__date__gt=date(2011,1,1)).order_by('comment__date') send that queryset to object_list and be able to only see the comments ordered by date with only so many objects on a page. E.g., if "Person A" has comments 12/3/11, 1/2/11, 1/5/11, "Person B" has no comments, and person C has a comment on 1/3, I would see: "Person A", 1/2 - comment "Person C", 1/3 - comment "Person A", 1/5 - comment I would strongly prefer not to have to switch to filtering based on Comments.objects.filter(), as that would make me have to largely repeat large sections of code in the both the view and template. Right now if I tried executing the following command, I will get a queryset returning (PersonA, PersonC, PersonA), but if I try rendering that in a template each persons comment_set will contain all their comments even if they aren't in the date range. Ideally they're would be some sort of functionality where I could expand out a Person queryset's comment_set into a larger queryset that can be sorted and ordered based on the comment and put into a object_list generic view. This normally is fairly simple to do in SQL with a JOIN, but I don't want to abandon the ORM, which I use everywhere else.

    Read the article

  • Ajax post failing in asp

    - by Dave Kiss
    hey guys, this might be really stupid, but hopefully someone can help. I'm trying to post to an external script using ajax so i can mail the data, but for some reason my data is not making it to the script. $(document).ready(function() { $("#submitContactForm").click(function () { $('#loading').append('<img src="http://www.xxxxxxxx.com/demo/copyshop/images/loading.gif" alt="Currently Loading" id="loadingComment" />'); var name = $('#name').val(); var email = $('#email').val(); var comment = $('#comment').val(); var dataString = 'name='+ name + '&email=' + email + '&comment=' + comment; $.ajax({ url: 'http://www.xxxxx.com/demo/copyshop/php/sendmail.php', type: 'POST', data: '?name=Dave&[email protected]&comment=hiiii', success: function(result) { $('#loading').append('success'); } }); return false; }); }); the php script is simple (for now - just wanted to make sure it worked) <?php $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; $to = '[email protected]'; $subject = 'New Contact Inquiry'; $message = $comment; mail($to, $subject, $message); ?> the jquery is embedded in an .aspx page (a language i'm not familiar with) but is posting to a php script. i'm receiving emails properly but there is no data inside. am i missing something? i tried to bypass the variables in this example, but its still not working thanks

    Read the article

  • Echo a multidimensional array in PHP

    - by Jennifer
    I have a multidimensional array and I'm trying to find out how to simply "echo" the elements of the array. The depth of the array is not known, so it could be deeply nested. In the case of the array below, the right order to echo would be: This is a parent comment This is a child comment This is the 2nd child comment This is another parent comment This is the array I was talking about: Array ( [0] => Array ( [comment_id] => 1 [comment_content] => This is a parent comment [child] => Array ( [0] => Array ( [comment_id] => 3 [comment_content] => This is a child comment [child] => Array ( [0] => Array ( [comment_id] => 4 [comment_content] => This is the 2nd child comment [child] => Array ( ) ) ) ) ) ) [1] => Array ( [comment_id] => 2 [comment_content] => This is another parent comment [child] => Array ( ) ) )

    Read the article

  • Handle submission of forms created dynamically having same class

    - by user1504383
    i am creating a form for users to comment on each posts displayed through a loop and the form for commenting is also in the same loop. Now i want each comment to be submitted via jquery ajax but each time its taking into account only the first form . Here is my code:- while($row=mysql_fetch_array($result)) { ?> <?=$row['title']?> <h4>Add commment </h4> <form class="add_comment" method="post"> <div style="display:none;"><input type="text" name="id" class="id" value="<?=$row['id']?>"/></div> <input type="text" name="comment" class="comment"/> <input type="submit" name="submit" value="add" class="submit"/> </form> <?php } ?> And my jquery goes here $("form.add_comment").submit(function(event) { event.preventDefault(); var comment =$('.comment').attr('value'); var id =$('.id').attr('value'); $.ajax({ type: "POST", url: "/add_comment", data: "comment="+comment+"&id="+id, success: function() { location.reload(); } }); return false; });`enter code here` i understood the error that it selects the first one by default but couldnt fix it up plz help me

    Read the article

  • How do I add the Disqus comment system to a Rails application in a similar fashion to Wordpress?

    - by Eric Lubow
    In Wordpress, the Disqus plugin allows you to choose to subscribe to a post via RSS or via email. Is there a pluign similar to the Wordpress plugin for Rails. Norman's Disqus plugin just uses the Disqus site to make it work. I was hoping to have things more stored locally. For an example of what I mean, take a look at this blog entry. I already know that since Rails (this application in particular) is using Authlogic (plus Facebook Connect), that Disqus cannot be too tightly coupled with the Authentication system. Has anyone ever done this or figured out a way to do this?

    Read the article

  • I want to use facebook connect in my website to register, login and comment on news articles or posts made by other users

    - by sasi kiran
    I would like to implement the following things in my website. I have done some extensive search over the internet but couldnt find and specific examples on how to implement them I am developing this site in php using a mvc framework Would like to have facebook registration on my website - users who have an account in facebook will get an option to use the details to register in my site, using their authentication I would pull the relavant details from their account and create a new account for them in my website. I would like to use facebook register fbml/fbjs in this case Would like to have facebook login used to login into my site. How to use the sessions is what I would like to know? I would like to make posts to the facebook-wall of the users registered in my site. Also if possible sent messages to them through my code whenever a new post is made to my site. Thanks for your help.

    Read the article

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