Search Results

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

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

  • Inline HTML Syntax for Helpers in ASP.NET MVC

    - by kouPhax
    I have a class that extends the HtmlHelper in MVC and allows me to use the builder pattern to construct special output e.g. <%= Html.FieldBuilder<MyModel>(builder => { builder.Field(model => model.PropertyOne); builder.Field(model => model.PropertyTwo); builder.Field(model => model.PropertyThree); }) %> Which outputs some application specific HTML, lets just say, <ul> <li>PropertyOne: 12</li> <li>PropertyTwo: Test</li> <li>PropertyThree: true</li> </ul> What I would like to do, however, is add a new builder methid for defining some inline HTML without having to store is as a string. E.g. I'd like to do this. <% Html.FieldBuilder<MyModel>(builder => { builder.Field(model => model.PropertyOne); builder.Field(model => model.PropertyTwo); builder.ActionField(model => %> Generated: <%=DateTime.Now.ToShortDate()%> (<a href="#">Refresh</a>) <%); }).Render(); %> and generate this <ul> <li>PropertyOne: 12</li> <li>PropertyTwo: Test</li> <li>Generated: 29/12/2008 <a href="#">Refresh</a></li> </ul> Essentially an ActionExpression that accepts a block of HTML. However to do this it seems I need to execute the expression but point the execution of the block to my own StringWriter and I am not sure how to do this. Can anyone advise?

    Read the article

  • Is inline SQL still classed as bad practice now that we have Micro ORMs?

    - by Grofit
    This is a bit of an open ended question but I wanted some opinions, as I grew up in a world where inline SQL scripts were the norm, then we were all made very aware of SQL injection based issues, and how fragile the sql was when doing string manipulations all over the place. Then came the dawn of the ORM where you were explaining the query to the ORM and letting it generate its own SQL, which in a lot of cases was not optimal but was safe and easy. Another good thing about ORMs or database abstraction layers were that the SQL was generated with its database engine in mind, so I could use Hibernate/Nhibernate with MSSQL, MYSQL and my code never changed it was just a configuration detail. Now fast forward to current day, where Micro ORMs seem to be winning over more developers I was wondering why we have seemingly taken a U-Turn on the whole in-line sql subject. I must admit I do like the idea of no ORM config files and being able to write my query in a more optimal manner but it feels like I am opening myself back up to the old vulnerabilities such as SQL injection and I am also tying myself to one database engine so if I want my software to support multiple database engines I would need to do some more string hackery which seems to then start to make code unreadable and more fragile. (Just before someone mentions it I know you can use parameter based arguments with most micro orms which offers protection in most cases from sql injection) So what are peoples opinions on this sort of thing? I am using Dapper as my Micro ORM in this instance and NHibernate as my regular ORM in this scenario, however most in each field are quite similar. What I term as inline sql is SQL strings within source code. There used to be design debates over SQL strings in source code detracting from the fundamental intent of the logic, which is why statically typed linq style queries became so popular its still just 1 language, but with lets say C# and Sql in one page you have 2 languages intermingled in your raw source code now. Just to clarify, the SQL injection is just one of the known issues with using sql strings, I already mention you can stop this from happening with parameter based queries, however I highlight other issues with having SQL queries ingrained in your source code, such as the lack of DB Vendor abstraction as well as losing any level of compile time error capturing on string based queries, these are all issues which we managed to side step with the dawn of ORMs with their higher level querying functionality, such as HQL or LINQ etc (not all of the issues but most of them). So I am less focused on the individual highlighted issues and more the bigger picture of is it now becoming more acceptable to have SQL strings directly in your source code again, as most Micro ORMs use this mechanism. Here is a similar question which has a few different view points, although is more about the inline sql without the micro orm context: http://stackoverflow.com/questions/5303746/is-inline-sql-hard-coding

    Read the article

  • How to add and relate a node within the parent nodes add form in Drupal.

    - by Espen Christensen
    Hi, I want to accomplish the following scenario in Drupal: You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons. Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be related to this lisence, and only this lisence. Say you would like to apply for a lisence, and relate 4 persons to this lisence, then insted of creating the lisence and then create the 4 persons and relate them to the lisence, i would like to do this "inline". So when i add a lisence, there would be a way to add 1 or more persons that would relate to the lisence node. Is this possible, and if so how? I have been looking at the node reference module, and that manages to reference a node to another, but not to add them inline with the other. With the web-development framework Django, there is a way to this with something called "inline-editing", where you get the content-type fields inside another content-type creation form. There you bind them togheter with a ForeignKey. Anybody know of something simular in Drupal, if not, is it another way to achive something simular, that would be as user-friendly?

    Read the article

  • CSS: Horizontal, comma-separated list with fixed <li> width

    - by hello
    Hello, I would like to achieve the following structure: [gfhtfg..., kgjrfg..., asd, mrhgf, ] ^-------^ ^-------^ ^-------^ ^-------^ X X X X (X = a fixed length) I've got a <div> with a fixed length, and inside it an horizontal, comma-separated list (ul) of links. The <li> elements should have a fixed width, and so if the links exceed a fixed length an ellipsis will be shown (using the text-overflow property). I know two ways to make a list horizontal. One is using display: inline and the other using the float property. With the first approach, I can't set a fixed width because the CSS specification doesn't allow setting the width of inline elements. The second approach creates a mess :O Setting float on the <a> element, intending to limit the width there, separates it from the commas. There are no browser-compatibility issues, I only have to support WebKit. I included the code I attempted to work with: <!DOCTYPE html> <html lang="en"> <head> <title>a title</title> <style> body { font-family: arial; font-size: 10pt; } div { height: 30px; width: 300px; background: #eee; border: 1px solid #ccc; text-align: center; } ul { margin: 0px; padding: 0px; } ul li:after { content: ","; } ul li:last-child:after { content: ""; } ul li a { text-decoration: none; color: #666; } ul li { margin: 0px; padding: 0px; list-style: none; overflow: hidden; text-overflow: ellipsis; -webkit-text-overflow: ellipsis; /* Inline elements can't have a width (and they shouldn't according to the specification */ display: inline; width: 30px; } </style> </head> <body> <div> <ul> <li><a href="#">a certain link</a></li> <li><a href="#">link</a></li> <li><a href="#">once again</a></li> <li><a href="#">another one</a></li> </ul> </div> </body> </html> Thank you.

    Read the article

  • Django multiple generic_inline_formset in a view

    - by Can Burak Cilingir
    We have a bunch of formsets: EmailAddressInlineFormSet = generic_inlineformset_factory( EmailAddress, extra=1, exclude=["created_by","last_modified_by"]) emailaddressformset = EmailAddressInlineFormSet( instance=person, prefix="emailaddress") # [ more definitions ] and, in the view, we process them as: emailaddressformset = EmailAddressInlineFormSet( request.POST, instance=person, prefix="emailaddress") # [ more definitions ] So, nothing fancy or unordinary. The unfortunate or unordinary fact is, we have 15 of these formsets, one for email addresses, other for phone numbers etc. so the view code is ugly and not-so-manageable. What would be the most unhackish way to handle this number of formsets in a single view? At the end -i guess- I'm looking for a class or a functionality like multiple_generic_inline_formset and open to all kind of suggestions or discussions.

    Read the article

  • Django ManyToMany Membership errors making associations

    - by jmitchel3
    I'm trying to have a "member admin" in which they have hundreds of members in the group. These members can be in several groups. Admins can remove access for the member ideally in the view. I'm having trouble just creating the group. I used a ManytoManyField to get started. Ideally, the "member admin" would be able to either select existing Users OR it would be able to Add/Invite new ones via email address. Here's what I have: #views.py def membership(request): group = Group.objects.all().filter(user=request.user) GroupFormSet = modelformset_factory(Group, form=MembershipForm) if request.method == 'POST': formset = GroupFormSet(request.POST, request.FILES, queryset=group) if formset.is_valid(): formset.save(commit=False) for form in formset: form.instance.user = request.user formset.save() return render_to_response('formset.html', locals(), context_instance=RequestContext(request)) else: formset= GroupFormSet(queryset=group) return render_to_response('formset.html', locals(), context_instance=RequestContext(request)) #models.py class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField(User, related_name='community_members', through='Membership') user = models.ForeignKey(User, related_name='community_creator', null=True) def __unicode__(self): return self.name class Membership(models.Model): member = models.ForeignKey(User, related_name='user_membership', blank=True, null=True) group = models.ForeignKey(Group, related_name='community_membership', blank=True, null=True) date_joined = models.DateField(auto_now=True, blank=True, null=True) class Meta: unique_together = ('member', 'group') Any ideas? Thank you for your help.

    Read the article

  • Python 2.4 inline if statements

    - by Marcus Whybrow
    I am setting up an existing django project on a dreamhost web server, so far I have got everything to work correctly. However I developed under python 2.5 and dreamhost by default uses python 2.4. The following line seems gives a syntax error because of the if keyword: 'parent': c.parent.pk if c.parent is not None else None ^ Is it the case that this form of if statement was introduced in Python 2.5, if so is there an easy change that would make it compatible with Python 2.4? Or, should I just change to Python 2.5. I have already installed python 2.5 to a directory under my home directory, and have succeeded in running the python interpreter under 2.5. If I wish to use Python 2.5 for everything, where can I set this?

    Read the article

  • Multi-statement Table Valued Function vs Inline Table Valued Function

    - by AndyC
    ie: CREATE FUNCTION MyNS.GetUnshippedOrders() RETURNS TABLE AS RETURN SELECT a.SaleId, a.CustomerID, b.Qty FROM Sales.Sales a INNER JOIN Sales.SaleDetail b ON a.SaleId = b.SaleId INNER JOIN Production.Product c ON b.ProductID = c.ProductID WHERE a.ShipDate IS NULL GO versus: CREATE FUNCTION MyNS.GetLastShipped(@CustomerID INT) RETURNS @CustomerOrder TABLE (SaleOrderID INT NOT NULL, CustomerID INT NOT NULL, OrderDate DATETIME NOT NULL, OrderQty INT NOT NULL) AS BEGIN DECLARE @MaxDate DATETIME SELECT @MaxDate = MAX(OrderDate) FROM Sales.SalesOrderHeader WHERE CustomerID = @CustomerID INSERT @CustomerOrder SELECT a.SalesOrderID, a.CustomerID, a.OrderDate, b.OrderQty FROM Sales.SalesOrderHeader a INNER JOIN Sales.SalesOrderHeader b ON a.SalesOrderID = b.SalesOrderID INNER JOIN Production.Product c ON b.ProductID = c.ProductID WHERE a.OrderDate = @MaxDate AND a.CustomerID = @CustomerID RETURN END GO Is there an advantage to using one over the other? Is there certain scenarios when one is better than the other or are the differences purely syntactical? I realise the 2 example queries are doing different things but is there a reason I would write them in that way? Reading about them and the advantages/differences haven't really been explained. Thanks

    Read the article

  • JQGRID inline dropdown binding via AJAX

    - by Frank
    jQuery(document).ready(function () { var grid = $("#list"); var AllCategory={"1":"Computing","2":"Cooking","10":"Fiction","3":"Finance","6":"Language","4":"Medical","11":"News","8":"Philosophy","9":"Religion","7":"Sport","5":"Travel"}; grid.jqGrid({ url: '/SupplierOrder/Select_SupplierOrderDetailByX/', editurl: "clientArray", datatype: 'json', mtype: 'GET', colNames: ['Category', 'Qty'], colModel: [ { name: 'Category', index: 'CategoryID', align: 'left', editable: true, edittype: "select", formatter: 'select', editoptions: { value: AllCategory }, editrules: { required: true } }, { name: 'Qty', index: 'Qty', width: 40, align: 'left', editable: true, edittype: "text", editoptions: { size: "35", maxlength: "50"} } ], pager: jQuery('#pager'), rowNum: 10, rowList: [5, 10, 20, 50], sortname: '', sortorder: '', viewrecords: true, autowidth: true, autoheight: true, imgpath: '/scripts/themes/black-tie/images', caption: 'Supplier Order Detail' }) grid.jqGrid('navGrid', '#pager', { edit: false, add: false, del: true, refresh: false, search: false }, {}, {}, {}, {}); grid.jqGrid('inlineNav', '#pager', { addtext: "Add", edittext: "Edit", savetext: "Save", canceltext: "Cancel" }); }); It is my JQGrid. Then, I remove below code ... var AllCategory={"1":"Computing","2":"Cooking","10":"Fiction","3":"Finance","6":"Language","4":"Medical","11":"News","8":"Philosophy","9":"Religion","7":"Sport","5":"Travel"}; Replace with below code so that i can get dynamic data ... var AllCategory = (function () { var list = null; $.ajax({ async: false, global: false, type: "POST", url: 'Category_Lookup', dataType: 'json', data: {}, success: function (response, textStatus, jqXHR) { list = response; }, error: function (jqXHR, textStatus, errorThrown) { alert("jqXHR.responseText --> " + jqXHR.responseText + "\njqXHR --> " + jqXHR + "\ntextStatus --> " + textStatus + " \nerrorThrown --> " + errorThrown); } }); alert(list); return list; })(); Firstly, I get below message box ... Then I get Error Could anyone please tell me how to make it correct ? Every suggestion will be appreciated.

    Read the article

  • MVC2 Inline XHTML Validator?

    - by GedByrne
    I am attempting to setup http://www.thejoyofcode.com/Validator_Module.aspx on a local MVC2 project. I have followed all of the steps listed in the setup guide but I cannot get the validator to kick in. If I create a bog standard .htm file or a webform with .aspx extension, I can get it to work. Anyone had any joy with this?

    Read the article

  • Inline base64 encoded link not working in Firefox

    - by Sjoerd
    I have this link: <a href="data:application/pdf;base64,JVBERi0x...KJSVFT0YK">PDF</a> In Safari on MacOsX, clicking the link instantly opens the PDF. In Firefox 3.6.2, it doesn't. When I choose Download, it saves it as "u7WYuJME.pdf(2).part", which is a valid PDF file. When I choose "Open with Preview", it downloads it but does not open it. Can I change something so that Firefox opens it correctly?

    Read the article

  • Creating an inline function in a jsp?

    - by user246114
    Hi, I'm coming from (some limited) PHP experience, in which you can just declare functions in-line. I'm trying to the same thing with a JSP but not working. Trying something like: <%! private void generateSomething() { %> <p> Hello there! </p> <% } %> <% generateSomething(); %> is something like that possible? Basically I have a jsp that can generate a 3 different pages, and I wanted to put these each in a separate method. I have seen a few posts saying this is not a good idea, and to separate the presentation stuff, which is fine, I just want to see this in action, if possible, now I'm just curious, Thanks

    Read the article

  • CSS IE6 float right

    - by David
    How come when I have a div style at display: block; float: right, in IE6 the div still goes under the text, and not in the middle of it just floated to the right. It works in all other browsers, including IE7+. I need to have display block because if i do display inline, then the menu inside the div is all messed up. .content { display: block; } .float { width: 150px; display: block; float: right; } .nothing { display: inline; } the float class is not to the right of nothing class, its under it in IE6, know a fix?

    Read the article

  • 301 versus inline rewrites

    - by Kristoffer S Hansen
    I'm in the process of adding 'pretty' URLs to an existing CMS, the menu is auto generated and the new 'pretty' URLs are to be handled independently as a seperate module. The auto-generated menu allways has URLs that look like this index.php?menu_id=n which ofcourse we would like to see as eg. /news or /products I'm currently at the point where I have to decide if I'm going to rewrite all output of the current system or simply put in a hook where I redirect to the 'pretty' URL. To put it differently, should i connect to the database, fetch all 'pretty' URLs, run through the existing output from WYSIWYG's, news modules, forums etc. and do some str_replace or other string manipulation (which I think would be a rather tedious and boring process), or should I simply hook in and throw a 301 redirecting index.php?menu_id=3 to /news will Google (or other search engines) penalize me for having 301's in the menus?

    Read the article

  • Inline widget-like templates in MODx

    - by Christoffer
    Hi, I'm developing my first ever MODx site and I need to have three blocks on the frontpage that contain headline, picture, image caption, long text and a short text. For these I would like to create a custom template that allows me to create sub-resources of "Home" with only these five fields (of which one will allow me to upload images). How can I set this up? Thanks!

    Read the article

  • Beginner LINQ to XML inline XML error

    - by Kyle B.
    Imports System.Xml.Linq Imports System.Linq Partial Class test2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim xml As XElement = <book> <title>My Title</title> <author>Kyle</author> <publisher>WROX</publisher> </book> End Sub End Class The above code is producing the following error: Compiler Error Message: BC30201: Expression expected. Source Error: Line 8: Line 9: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Line 10: Dim xml As XElement = <book> Line 11: <title>My Title</title> Line 12: <author>Kyle</author> Source File: C:\Inetpub\wwwroot\myproject\web\test2.aspx.vb Line: 10 Why? edit: Dim xml As XElement = New XElement("book", _ New XElement("title", "My Title"), _ New XElement("author", "Kyle"), _ New XElement("publisher", "WROX") _ ) The above code works, but obviously is not as elegant as the original and I would still appreciate an explanation of why my original syntax is wrong.

    Read the article

  • JavaScript inline events syntax

    - by Mic
    Is there any reason to use one of the following more than the others: <input type="button" value="b1" onclick="manageClick(this)" /> <input type="button" value="b2" onclick="manageClick(this);" /> <input type="button" value="b2" onclick="manageClick(this);return false;" /> <input type="button" value="b3" onclick="return manageClick(this);" /> <input type="button" value="b4" onclick="javascript:return manageClick(this);" /> And please do not spend your valuable time to tell me to use jQuery or attachEvent/addEventListener. It's not really the objective of my question.

    Read the article

  • create parent child array from inline data in php

    - by abhie
    actually i have simple problem but i forget how to solve it.. :D i have data on table with following format 01 Johson 01 Craig 01 Johson 02 Daniel 01 Johson 03 Abbey 02 Dawson 01 Brown 02 Dawson 02 Agust 03 Brick 01 Chev 03 Brick 01 Flinch so i want it to become an array like this 01 Johson => 01 Craig ``````````````02 Daniel ```````````````03 Abey ` etc... how to iterate trough the data and make it array like that... i'm newby in PHP :))

    Read the article

  • detachEvent not working with named inline functions

    - by Polshgiant
    I ran into a problem in IE8 today (Note that I only need to support IE) that I can't seem to explain: detachEvent wouldn't work when using a named anonymous function handler. document.getElementById('iframeid').attachEvent("onreadystatechange", function onIframeReadyStateChange() { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", onIframeReadyStateChange); // code here was running every time my iframe's readyState // changed to "complete" instead of only the first time }); I eventually figured out that changing onIframeReadyStateChange to use arguments.callee (which I normally avoid) instead solved the issue: document.getElementById('iframeid').attachEvent("onreadystatechange", function () { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", arguments.callee); // code here now runs only once no matter how many times the // iframe's readyState changes to "complete" }); What gives?! Shouldn't the first snippet work fine?

    Read the article

  • ASP.NET/MVC: Inline code

    - by JamesBrownIsDead
    What am I doing wrong? How come <%: this %> isn't being interpreted as C#? Here's the code (ignore the left side): And here is what it renders (notice the Firebug display): What do you think is going on? MVC newb here. :(

    Read the article

  • Android change context for findViewById to super from inline class

    - by wuntee
    I am trying to get the value of a EditText in a dialog box. A the "*"'ed line in the following code, the safeNameEditText is null; i am assuming because the 'findVeiwById' is searching on the context of the 'AlertDialog.OnClickListener'; How can I get/change the context of that 'findViewById' call? protected Dialog onCreateDialog(int id) { AlertDialog.Builder builder = new AlertDialog.Builder(this); switch(id){ case DIALOG_NEW_SAFE: builder.setTitle(R.string.news_safe); builder.setIcon(android.R.drawable.ic_menu_add); LayoutInflater factory = LayoutInflater.from(this); View newSafeView = factory.inflate(R.layout.newsafe, null); builder.setView(newSafeView); builder.setPositiveButton(R.string.ok, new AlertDialog.OnClickListener(){ public void onClick(DialogInterface dialog, int which) { * EditText safeNameEditText = (EditText) findViewById(R.id.new_safe_name); String safeName = safeNameEditText.getText().toString(); Log.i(LOG, safeName); setSafeDao(safeName); } }); builder.setNegativeButton(R.string.cancel, new AlertDialog.OnClickListener(){ public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); return(builder.create()); default: return(null); } }

    Read the article

  • Inline comments for bash?

    - by Lajos Nagy
    I'd like to be able to comment out a single flag in a one-line command. Bash only seems to have `from # till end-of-line' comments. I'm looking at tricks like: ls -l $([ ] && -F is turned off) -a /etc It's ugly, but better than nothing. Anybody has any better suggestions?

    Read the article

  • Django-ckeditor inline error

    - by ad3w
    I'm using FeinCMS (https://github.com/feincms/feincms/) and django-ckeditor with file upload support (https://github.com/shaunsephton/django-ckeditor). I create a FeinCMS content type for RichTextField: class RichContent(models.Model): text = RichTextField(_('text')) class Meta: abstract = True verbose_name = _('Rich Text') verbose_name_plural =_('Rich Text') def render(self, **kwargs): context_instance = kwargs.get('context_instance') return render_to_string('content/page/rich_content.html', { 'page': self, }, context_instance=context_instance) But in Django admin, when i select 'Rich Text' and press 'Go', get this error in firebug console: uncaught exception: [CKEDITOR.editor] The instance "id_richcontent_set-__prefix__-text" already exists. And textarea in ckeditor do not editable.

    Read the article

  • help with inline images/mail with cron - php?

    - by David Verhulst
    I've got mailings that need to be sended using cron. When I load the script manualy all works fine. With cron i get broken images. to change the src of my img i used: $body = eregi_replace("managersrc_logo","images/managers/acertainlogo.jpg",$body); Because i thaught that it is importent to use absolute paths i also tried: $body = eregi_replace("managersrc_logo","http://www.site.com/images/managers/acertainlogo.jpg",$body); In that case i even do not see the images when i run the cronscript manualy. Nor the automated cron will display me the images. When i check the source of the mail that is received i always see "cid:encryptedstuff" even if i use absolute paths? Why is that? I just want my absolute paths being printed in the src attribute of the img tag. Who changes my absolute path to cid: ? is it php, phpmailer or outlook itself? Any help someone?.... David

    Read the article

  • Good way to handle inline-edit form using Rails and jQuery

    - by Tim Sullivan
    I have a list of items, being displayed in a series of DIVs. When someone clicks on an "edit" link, I want to replace the div with a form that will let them edit the contents of that item in a nice way. I'm trying to think of the ideal way to handle this. Do I create a hidden edit form for every item in the list, and hook the edit link to reveal it, like this: <div> <a href="#">edit</a> Item One <div id="edit_1202" class="editform">Edit form goes here</div> </div> <div> <a href="#">edit</a> Item Two <div id="edit_2318" class="editform">Edit form goes here</div> </div> Or is there a better way to fetch the data and insert the form's HTML into the right spot? Remember, I'm using jQuery, so I can't use the prototype helpers. Thanks!

    Read the article

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