Search Results

Search found 1821 results on 73 pages for 'inline formset'.

Page 8/73 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Alternative to before </body> tag inline Javascript

    - by Mohammad
    I know inline Javascript is frowned upon and with the new on-the-fly Javascript compressors that check for idle/unused function usage and omit the unused code, it seems good practice to have all your Javascript in an external file. My question is, in situations like FOUC (flash of unstyled content) which usually require little snippets of code right before the closing </body> tag, is there a JQuery resolution that would serve the same purpose, but from a remote Javascript file linked in the <head> of the document?

    Read the article

  • Javascript: Inline function vs predefined functions

    - by glaz666
    Can any body throw me some arguments for using inline functions against passing predefined function name to some handler. I.e. which is better: (function(){ setTimeout(function(){ /*some code here*/ }, 5); })(); versus (function(){ function invokeMe() { /*code*/ } setTimeout(invokeMe, 5); })(); Strange question, but we are almost fighting in the team about this

    Read the article

  • Dynamically Delete inline formsets in Django

    - by BenMills
    Is it possible to have Django automatically delete formsets that are not present in the request? So for example if I had three inline formsets represented in HTML when I loaded my edit page and I use javascript to remove two of those when the request is processes Django sees that those two forms are no longer their and deletes them.

    Read the article

  • inline and member initializers

    - by Alexander
    When should I inline a member function and when should I use member initializers? My code is below.. I would like to modify it so I could make use some inline when appropriate and member initializers: #include "Books.h" Book::Book(){ nm = (char*)""; thck = 0; wght = 0; } Book::Book(const char *name, int thickness, int weight){ nm = strdup(name); thck = thickness; wght = weight; } Book::~Book(){ } const char* Book::name(){ return nm; } int Book::thickness(){ return thck; } int Book::weight(){ return wght; } // // Prints information about the book using this format: // "%s (%d mm, %d dg)\n" // void Book::print(){ printf("%s (%d mm, %d dg)\n", nm, thck, wght); } Bookcase::Bookcase(int id){ my_id = id; no_shelf = 0; } int Bookcase::id(){ return my_id; } Bookcase::~Bookcase(){ for (int i = 0; i < no_shelf; i++) delete my_shelf[i]; } bool Bookcase::addShelf(int width, int capacity){ if(no_shelf == 10) return false; else{ my_shelf[no_shelf] = new Shelf(width, capacity); no_shelf++; return true; } } bool Bookcase::add(Book *bp){ int index = -1; int temp_space = -1; for (int i = 0; i < no_shelf; i++){ if (bp->weight() + my_shelf[i]->curCapacity() <= my_shelf[i]->capacity()){ if (bp->thickness() + my_shelf[i]->curWidth() <= my_shelf[i]->width() && temp_space < (my_shelf[i]->width() - my_shelf[i]->curWidth())){ temp_space = (my_shelf[i]->width()- my_shelf[i]->curWidth()); index = i; } } } if (index != -1){ my_shelf[index]->add(bp); return true; }else return false; } void Bookcase::print(){ printf("Bookcase #%d\n", my_id); for (int i = 0; i < no_shelf; i++){ printf("--- Shelf (%d mm, %d dg) ---\n", my_shelf[i]->width(), my_shelf[i]->capacity()); my_shelf[i]->print(); } }

    Read the article

  • Using .align in inline assemby

    - by tech74
    Hi, I'm using ".align 16 \n\t" in some inline ARM assembly that is implementing some loops to align it on a 16 byte boundary however gcc asm compiler is complaining that alignement is too large i want to implement -falign-loops=16 in asm for a particular loop Thanks

    Read the article

  • Filter Queryset in Django inlineformset_factory

    - by Dave
    I am trying to use inlineformset_factory to generate a formset. My models are defined as: class Measurement(models.Model): subject = models.ForeignKey(Animal) experiment = models.ForeignKey(Experiment) assay = models.ForeignKey(Assay) values = models.CommaSeparatedIntegerField(blank=True, null=True) class Experiment(models.Model): date = models.DateField() notes = models.TextField(max_length = 500, blank=True) subjects= models.ManyToManyField(Subject) in my view i have: def add_measurement(request, experiment_id): experiment = get_object_or_404(Experiment, pk=experiment_id) MeasurementFormSet = inlineformset_factory(Experiment, Measurement, extra=10, exclude=('experiment')) if request.method == 'POST': formset = MeasurementFormSet(request.POST,instance=experiment) if formset.is_valid(): formset.save() return HttpResponseRedirect( experiment.get_absolute_url() ) else: formset = MeasurementFormSet(instance=experiment) return render_to_response("data_entry_form.html", {"formset": formset, "experiment": experiment }, context_instance=RequestContext(request)) but i want to restrict the Measurement.subject field to only subjects defined in the Experiment.subjects queryset. I have tried a couple of different ways of doing this but I am a little unsure what the best way to accomplish this is. I tried to over-ride the BaseInlineFormset class with a new queryset, but couldnt figure out how to correctly pass the experiment parameter.

    Read the article

  • How do I create an empty Django formset using modelformset_factory?

    - by nbolton
    I'm creating a formset, but it seems to populate it with all of the existing data in the table for that object. I can't figure out how to start with a blank formset; the only way seems to be to delete all of the data from the table, but clearly this isn't an option. I will post code if necessary (but there's lots of it, so knowing what is relevant is tricky).

    Read the article

  • Block elements vs inline elements in HTML: why the distinction?

    - by EpsilonVector
    The distinction between block and inline elements always seemed strange to me. The whole difference is that a block element takes up the entire width thus forcing a line break before and after the element, and an inline element only takes up as much as the content. Why not just have one type of element- an inline element where you can also apply custom height/width, and use that? You want line breaks? Insert a <br />, or maybe add a special tag in the CSS for that behavior. The way it's now, I don't see it solving any problem, and instead it only forces a property that in my opinion should be decided by a designer. So why the two types?

    Read the article

  • display:inline-block and text-indent

    - by Daniele Cruciani
    I am experiencing a problem with the following code in some versions of Internet Explorer: #iconautente{ background-image:url('/style/images/spritecommon.png'); /*icona_utente.png*/ background-position:-117px -15px; text-indent:-9000px; width:20px; height:23px; display:inline-block; } <a id="iconautente" href="/admin/index.php">admin</a> In Firefox, IE7 and IE8 under Vista, I see background and no text, as expected. In IE6 and IE8 under XP, the whole image is indented, not text, so the image is not shown. What should be the right behavior? Is there a workaround?

    Read the article

  • RegEx to extract all HTML tag attributes including inline JavaScript

    - by Mike
    I found this useful regex code here while looking to parse HTML tag attributes: (\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']? It works great, but it's missing one key element that I need. Some attributes are event triggers that have inline Javascript code in them like this: onclick="doSomething(this, 'foo', 'bar');return false;" Or: onclick='doSomething(this, "foo", "bar");return false;' I can't figure out how to get the original expression to not count the quotes from the JS (single or double) while it's nested inside the set of quotes that contain the attribute's value.

    Read the article

  • javascript removeChild() and appendChild() VS display=none and display=block|inline

    - by Kucebe
    I'm developing a web application that shows some controls and descriptions dinamically (I don't want to use jQuery or other libraries). At this moment i make appear and disappear controls using: element.setAttribute("style", "inline"); and element.setAttribute("style", "none"); but i'm thinking about using: element.appendChild(childRef); and element.removeChild(childRef); So, which one is the best solution in terms of system speed and elegance of the code? (and of course, are there better solution?)

    Read the article

  • Including inline javascript using content_for in rails

    - by TenJack
    I am using content_for and yeild to inject javascript files into the bottom of my layout but am wondering what the best practice is for including inline javascript. Specifically I'm wondering where the put the script type declaration: <% content_for :javascript do %> <script type="text/javascript"> ... </script> <% end %> or <% content_for :javascript do %> ... <% end %> <script type="text/javascript"> <%= yield :javascript %> </script> <% end %> I am using the first option now and wondering if it is bad to include multiple ... declarations within one view. Sometimes I have partials that lead to this.

    Read the article

  • How to show content from contentPlaceholder inline

    - by H4mm3rHead
    Hi, I have a page where i in my masterpage have a toolbar with a "Home" button to the far left. This button is not in a contentplaceholder but on the page. I want to have the opportunity for derived pages to add their own controls or whatever to the toolbar to be whown after the "home" button. But how to do this? I have tried to put in a content placeholder, but it seems that i cannot get it to show inline with the other stuff, it breaks and the content of the contentplaceholder is shown below the button instead. anyone know how to solve this? /Brian

    Read the article

  • jquery lightbox inline - without popup

    - by Michal
    i like jquery lightbox control looks nice and shows me a title one 1 of x images etc. I need exactly the same thing but without pop up. So whas is now visible after i click thumnail of image i want it to by visible as inline content somewhere on my page with first image loaded and then i could just use next prev. of course in this case, close would not be applicable. Does anybode know such a jquery plugin or how to change lightbox to work withoud popup? Thanks.

    Read the article

  • Inline Conditional Statement in Stored Procedure

    - by Jason
    Here is the pseudo-code for my inline query in my code: select columnOne from myTable where columnOne = '#variableOne#' if len(variableTwo) gt 0 and columnTwo = '#variableTwo#' end I would like to move this into a stored procedure but am having trouble building the query correctly. I assume it would be something like select columnOne from myTable where columnOne = @variableOne CASE WHEN len(@variableTwo) <> 0 THEN and columnTwo = @variableTwo END This is giving me a syntax error. Could someone tell me what I've got wrong. Also, I would like to keep it to only one query and not just have one if statement. Also, I do not want to build the sql in the stored procedure and run Exec() on it.

    Read the article

  • Cell padding within inline CSS

    - by GregH
    I have a table within a div (see below). How do I add a right padding of say 30px to each cell/column within the table in that div? My understanding is that I have to use inline CSS? Basically, I want each cell to be padded on the right by 30 pixels. <div id="ddTopMenu";> <table border="0" > <tr> <td width=100></td><td >Dictionary</td><td>Search</td><td>Sources</td><td>References</td> </tr> </table> </div>

    Read the article

  • Jquery UI Datepicker Date Range Inline Problem

    - by codeworxx
    Hey Guys, i have a big Problem with jQuery UI Datepicker. I have two Input Fields "From Date" and "To Date". When i choose a From Date - a Daterange of only 5 Days should appear on the "To Date" Picker. I used the Code from "Russ Cam" http://stackoverflow.com/questions/330737/jquery-datepicker-2-inputs-textboxes-and-restricting-range It worked perfect. Now my Problem: I have a second Calendar which is INLINE, means no Input Fields - it's shown directly on the Page - with "From Date" and "To Date". In this Calendar the Script does not work! All Fields in "From Date" and in the "To Date" are available - no Date Range Restrictions or something else. What's wrong here? Can someone give me a hint?

    Read the article

  • Django: Extending User Model - Inline User fields in UserProfile

    - by Jack Sparrow
    Is there a way to display User fields under a form that adds/edits a UserProfile model? I am extending default Django User model like this: class UserProfile(models.Model): user = models.OneToOneField(User, unique=True) about = models.TextField(blank=True) I know that it is possible to make a: class UserProfileInlineAdmin(admin.TabularInline): and then inline this in User ModelAdmin but I want to achieve the opposite effect, something like inverse inlining, displaying the fields of the model pointed by the OneToOne Relationship (User) in the page of the model defining the relationship (UserProfile). I don't care if it would be in the admin or in a custom view/template. I just need to know how to achieve this. I've been struggling with ModelForms and Formsets, I know the answer is somewhere there, but my little experience in Django doesn't allow me to come up with the solution yet. A little example would be really helpful!

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >