w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
nested_form/cocoon: is it okay to use table rows for nested fields?
Yes. If you are inputting tabular data then you should use a table. I haven't tested the following examples but I think it should work. Assuming you are building a receipt with a bunch of line items, each with a description and price. In your view do: %table %thead %tr %th Description %th Price %tbody.line_items = f.simple_fields_for :line_items do |f| = render 'line_item_fields', f: f .links = link_to_add_association "Add", f, :line_items, data: {"association-insertion-node" => "tbody.line_items", "association-insertion-method" => "append"} association-insertion-node: This controls where to insert the new line_item. In the example I use the table body. association-insertion-method: The jQuery method used to insert the new line_item. In the exampl

Categories : HTML

Saving a dynamically generated table with some input fields into mysql table
I don't know if i understand the question. You want to insert data from this table into a mysql db table? If so you should have <form method="POST" action="page_where_inserting_in_mysql"> ... </form> And into the new page you should have mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("db_name") or die(mysql_error()); mysql_query("INSERT INTO table_name (field1, field2, ...) VALUES('".$_POST['value1']."', '".$_POST['value2']."',... ) ") or die(mysql_error()); Hope it helps. If you meant something else with you're question, please tell me. I'll help you if I can.

Categories : PHP

Create PDF and give names to fields and Fill data into fields dynamically c#
The best option is iTextSharp, by far the easiest way to render pdf. You can use html templates and dinamically replace values or just render any webcontrol into a html string and save it as pdf. You can have something like this string html = "<h1>[PAGE_TITLE]<h1/>[STUDENTS]"; //get your values here ... html = html.Replace("[PAGE_TITLE]", MyPageTitle); html = html.Replace("[STUDENTS]", MyStudentsTableHtml); Then with iTextSharp (Taken from http://www.4guysfromrolla.com/articles/030911-1.aspx) // Create a Document object var document = new Document(PageSize.A4, 50, 50, 25, 25); // Create a new PdfWriter object, specifying the output stream var output = new MemoryStream(); var writer = PdfWriter.GetInstance(document, output); // Open the Document for writing document.Open

Categories : C#

How to add dynamic fields using a counter to limit the number of fields in jQuery
Try to check the count like this: if($("tr.tre").length<5) before you adding new row . Jsfiddle: http://jsfiddle.net/gKJEs/81/

Categories : Javascript

How do I post SQL generated fields?
I was doing something similar recently, I needed to collect an array of arrays of data of variable length that had been added to the DOM. I'm not sure if this is the best practice, but I ended up doing this: foreach ($_POST as $key=>$obj) { if (preg_match('/^rowd+$/',$key)) { // some code to manipulate $obj } } see more on preg_match I had named each input in the table : name="row"+i+"[fieldName]" Again, I'm not sure if this is 'best practice', but it worked for my purposes. I hope it helps!

Categories : PHP

User-generated fields in Django
If I correctly understand, you don't need dynamic model fields, instead you can add model, which contains specific attributes for image in project, something like: class Image(models.Model): name = models.CharField() img = models.ImageField() class ProjectImage(models.Model): image = models.ForeignKey('Image') project = models.ForeignKey('Project') flag = models.CharField(choices=PASS_FAIL_UNKNOWN) class ProjectImageTag(models.Model): project_image = models.ForeignKey(ProjectImage) value = models.CharField() class Project(models.Model): images = models.ManyToManyField('Image', through=ProjectImage) Also, you can store such tags in json field or postgres hstore field instead of separate table. EDIT Variation with predefined keys: class ProjectImage(m

Categories : Django

Rails 3: Why am I not able to see the input fields that should be generated by form_for?
You have to put <%= opening tag in your form_for instead of <%. <%= form_for @track do |f| %> <%= f.error_messages %> <p> <%= f.text_field :youtube_url %> <%= f.submit 'Add' %> </p> <% end %>

Categories : Ruby On Rails

Generated fields not triggering a script with .blur()
Your handler is trying to bind to elements that don't yet exist at DOM ready, you have to use event delegation: $(document).on('blur', '.check-total', function() { //code here });

Categories : Javascript

Duplicate fields in generated propel Base class
The problem is that Propel is adding a collection of issues from two different places, once from the foreign key in issue and one from the foreign key in user_issue. It's an easy fix, you just need to use the refPhpName attribute. Check the Propel docs for more on the foreign-key attribute. <table name="issue" phpName="Issue"> <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true"/> <column name="title" type="varchar" size="255" required="true" /> <column name="description" type="varchar" size="200" required="true" phpName="Description"/> <column name="user_id" type="integer" required="true"/> <!-- notice the additional attributes below --> <foreign-key foreignTable="user" phpName="Creator" re

Categories : PHP

AJAX + PHP self-generated fields producing blank results
You need to urlencode the parameter that is being passed via ajax. The ampersand is telling PHP that $_GET['q'] is complete and a new $_GET variable is starting. Notice the %26 for the ampersand returns the desired result. http://healthbenefitsohio.com/process.php?q=Anthem%20Blue%20Cross%20%26%20Blue%20Shield Your company options should look like this: echo '<option value="'.urlencode($row['Company']).'">'.$row['Company'].'</option>'; For good measure, I would also encode the display echo '<option value="'.urlencode($row['Company']).'">'.htmlspecialchars($row['Company'],ENT_QUOTES).'</option>';

Categories : PHP

Dynamically generated images: nginx + php-fpm
Usually real time processing like this is really a bad idea, if you get a high traffic at some point it will effect your system badly, is there a way you could queue those images for processing then handle them by a cron job? And if you still want to do it your way i would suggest making the php script issue a redirect response when it's done, given that you know for sure that it wont take a long time to generate that image, or make it reply with the image data directly after giving the correct content-type to the browser.

Categories : Nginx

Why are my Dynamically Generated Controls not taking an ID value
You are not setting control ID property. Adding "id" to their attribute collection leaves ID property empty. Then it gets auto-assigned by ASP.NET for the purpose of producing unique html id/name values. Do: Qdiv.ID = question.@Name.ToString & "div" lbl1.ID = question.@Name.ToString & "lbl" tb1.ID = question.@Name.ToString & "tb" You seem to add a number of things to Attributes collection that should be set using explicit control properties.

Categories : Asp Net

add previous row data to dynamically generated row
replace your function with this function(Jqeury Solution) function addrow(tableID) { var table=$('#'+tableID); var val1=$('#mode').val(); for(i=0;i<parseInt(val1);i++) { table.find('tr:last').after('<tr>'+table.find('tr:last').html()+'</tr>'); } }

Categories : Javascript

Dynamically Generated Dropdowns Postback
You are doing it right, but you have to recreate the controls with datasource and rebinding all controls again. Without this beeing done, you are creating controls that not match the previous. You can call your first method to do that.

Categories : C#

How do add an EventHandler for a dynamically generated Button
Create your buttons with an ID before you bind the event: Button btn1 = new Button(); btn1.ID = "btnMyButton"; btn1.Click += new EventHandler(this.btn1_Click); Make sure every button has an unique ID. Also, I would personally move the code to Page_Init instead of Page_Load.

Categories : C#

How to debug dynamically generated method?
You need to mark the generated code as debuggable. Something like: Type daType = typeof(DebuggableAttribute); ConstructorInfo ctorInfo = daType.GetConstructor(new Type[] { typeof(DebuggableAttribute.DebuggingModes) }); CustomAttributeBuilder caBuilder = new CustomAttributeBuilder(ctorInfo, new object[] { DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.Default }); assembly.SetCustomAttribute(caBuilder); You also should add a sourcefile: ISymbolDocumentWriter doc = module.DefineDocument(@"SourceCode.txt", Guid.Empty, Guid.Empty, Guid.Empty); You should now be able to step into the dynamically generated method.

Categories : Dotnet

retrieving the value of dynamically generated Textboxes in asp.net
Try this: New Class: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; /// <summary> /// Summary description for OhterMethods /// </summary> public static class OhterMethods { public static List<Control> FlattenChildren(this Control control) { var children = control.Controls.Cast<Control>(); return children.SelectMany(c => FlattenChildren(c).Where(a => a is TextBox || a is Label || a is Literal || a is Button || a is GridView || a is HyperLink || a is DropDownList)).Concat(children).ToList(); } public static List<Control> GetAllControls(Control control) { var children = control.Controls.Cast<Control>();

Categories : Asp Net

How to get values from dynamically generated controls in asp.net c#?
As I already answered here all dynamic controls should be reinitiated in Page's Init event, as viewstate manager values are set every request. You can check page's lifecycle. So right now, when you do not create you control in init event, viewstates misses them while it is setting postback data, and when you do try to get values, they are equal to zeros. Keep in mind, that you have to create the same control types with the same names.

Categories : C#

how to insert value to sql db from dynamically generated textboxes asp.net
Hai I got Output By Using Temperory data(Not like your data).So by Using the Below Logic You can get your output. At First I take database table like orders(id int,person_name varchar(20)) Then according to my database I use the logic below.Here I use label for checking only public partial class stack_over : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } string connString = "Your Database Connection String"; protected void btnGenerateControl_Click1(object sender, EventArgs e) { int Count = Convert.ToInt32(Qty.Text); for (int i = 1; i <= Count; i++) { pnlTextBoxes.Controls.Add(new LiteralControl("<input id='txt' name='Textbox" + i + "' type='text' />")); pnlTextBoxes.Controls.Add(new LiteralControl("<br /&

Categories : Asp Net

Removing dynamically generated buttons
The click event handler has the signature private void myButton_Click(object sender, EventArgs e) The object sender is the source of the event. Just cast that to a Button, and there's what got clicked: Button whatWasClicked = sender as Button; if(whatWasClicked == null) // never mind -- it wasn't a button...

Categories : C#

Changing CSS in dynamically generated HTML
I didn't fully understand how you want to color your results, but I think you can use your fieldset classes. For example: .ui-grid-b div { color: red; } .ui-grid-c div { color: green; } If you don't know how many fieldsets you're going to have and you can't use the fieldset classes you showed in your code example, you might find the nth-child selector useful. Maybe something like this: fieldset:nth-child(2n) div { color: red; } fieldset:nth-child(2n+1) div { color: green; }

Categories : HTML

How to include a dynamically generated SVG to a Vaadin UI?
So, seems the answer is that for a SVG to be displayed in Vaadin 7 one should use the BrowserFrame to display the SVG resource. Using something like below where sourceSVG is a streamSource containing the SVG data. StreamResource ressourceSVG = new StreamResource(sourceSVG, "graphe.svg"); BrowserFrame embedded = new BrowserFrame("SVG", ressourceSVG); verticalLayout.addComponent(component); verticalLayout.addComponent(embedded); setContent(verticalLayout); Had to reload the frame after loading the webpage but it finally worked

Categories : Java

EDIT: add an identifier to a dynamically generated row
Judging by your code, you can use <input type="hidden" name="some_hidden_data" value="field-value">. be sure that you also wrap your table with <form method="post"></form> the hidden field will be then included as $_POST['hidden_field_name'];

Categories : PHP

Dynamically generated html doesn't contain />, but > instead
jQuery won't generate HTML. It will modify the DOM. You might then use innerHTML (possibly via jQuery(...).html()) or a DOM inspector to serialize the DOM to HTML. If you are in HTML mode (i.e. the document was served as text/html) then you will get HTML out. Browsers might give you XHTML if you serve the document as XHTML (i.e. with Content-Type: application/xhtml+xml), but they don't provide a way to generate XHTML when in HTML mode. If not, is it a big deal if i don't have it? It's a huge deal. The markup won't be well formed and XML parsers will throw an error and stop. I'd recommend using HTML instead of XHTML. If you want to target XML parsers, then generate HTML and pass it to something server side that can parse HTML and output XHTML.

Categories : Jquery

Where should I save files dynamically generated by the ASP.NET Web API?
You can write to any location your application stores data in. I recommend using the system Temp directory, that's what it's there for (System.IO.Path.GetTempPath()) or if your have write access, a subdirectory of your application: String path = Server.MapPath("~/Temp"); if( !Directory.Exists( path ) ) Directory.CreateDirectory( path ); using(FileStream fs = File.OpenWrite( Path.Combine( path, "TempFileName.dat" ) )) { fs.Write( new Byte[1024] ); }

Categories : Asp Net

Run dynamically generated assembly in C (GNU/Linux)
I think ultimately to be "JIT" you need to be time sensitive which means generate machine code. You might try putting in some debug code that generates both machine code to run and assembly code to verify, run the assembler compare the machine code from the assembly language to the machine code you generated directly and use that to debug/validate the machine code (if possible, sometimes assemblers want to do their own thing, not what you wanted them to do).

Categories : C

Can controller get textfields from view in rails app where fields are generated from loop:
In the book Rails Recipe (2012), there is one recipe I think suit your purpose. Recipe 36 Create one form for many models Class Recipe < ActiveRecord::Base has_many :ingredients accepts_nested_attributes_for :ingredients end Class Ingredient < ActiveRecord:Base belongs_to :recipe end Add a Recipe <%= form_for @recipe do |f| %> <%= f.label :name %> <%= f.text_field :name %> <%= f.label :instructions %> <%= f.text_area :instructions %> <%= f.fields_for(:ingredients) do |ingredients_form| %> <%= ingredients_form.label :name %> <%= ingredients_form.text_field :name %> <%= ingredients_form.label :quantity %> <%= ingredients_form.text_field :quantity %> <% end %> <%= f.submi

Categories : Ruby On Rails

jQuery generated select option not working on dynamic fields
A quick way to do it is to move the code currently being called in $(function...) into a function within $(document).ready(). After you define the function, call it so that the initial select menus will have the dates applied. Then, in the if(x <= MaxInputs) statement, before you call x++;, call the function again. You can see the fix here: http://jsfiddle.net/PnRnR/1/ The issue is that you called the function only once on load, when you needed to call it everytime you added a new checkbox.

Categories : Jquery

Doctrine Behaviors fields in Symfony2 auto-generated CRUD
app/console doctrine:generate:crud command use generate:doctrine:form command which generate fields for all entity properties. So yes, you must remove unnecessary fields from form OR use more advenced generators like AdmigeneratorGeneratorBundle.

Categories : Symfony2

Get/Set values of dynamical generated input fields using ng-repeat in Angular
So add ng-model="inputs[i-1]" to your text field Then in your controller add $scope.inputs= []; Then in your getValue function: return $scope.inputs[id-1]; If you make your getTimes function 0 based you wouldn't need the -1s Updated your fiddle: http://jsfiddle.net/7MhLd/60/

Categories : Angularjs

In Capybara, how can I select a dynamically generated element
By default, Capybara uses CSS to find the elements. I believe that the right way to find that element should be: within("tr##{item.id}-#{item.name.downcase}") do ... I hope this helps.

Categories : Ruby On Rails

Dynamically Generated AJAX/JS calculator form
Here is a jQuery example: You should be able to get the values of the inputs on a blur function. And then update the values by running an each function on the inputs. Something like this... <ul> <li> <label>Number of X</label> <input type="text" value="" id="x"/> </li> <li> <label>Number of Y</label> <input type="text" value="" id="y"/> </li> <li> <label>Number of Z</label> <input type="text" value="" id="z"/> </li> </ul> <p>Total is: <span class="total"></span> jQuery: $('input').blur(function () { var total = 0; $('input').each(function() { total += Number($(this).val()); }

Categories : Javascript

Marker is not displaying when it is generated dynamically using jquery
The problem is that by adding the SVG elements as text using jquery, they are getting interpreted in the wrong namespace. That is, there are no defs, marker, etc elements in HTML and therefore they don't do anything. These elements are only valid in the SVG namespace, which you don't specify when adding them dynamically. When they are specified statically, the namespace is obvious from the context. There are several ways to fix this. You could explicitly create the nodes with the correct namespace and add them at the appropriate location. An easier solution however is to use D3 to add those elements, which will take care of the namespace issues for you. The code would be a bit more verbose, but straightforward. svg.append("defs").append("marker") .attr("id", "arrow") .attr("viewb

Categories : Javascript

Provide ID to dynamically generated cloned element
Being droptargetOnDrop your drop event handler, you should do: function droptargetOnDrop(e) { var newEl = $(e.draggable.currentTarget).clone(); newEl.attr("id",kendo.guid()); e.dropTarget.append(newEl); } See your fiddle modified running here: http://jsfiddle.net/OnaBai/rTxaE/2/

Categories : Kendo Ui

Using foreach to submit a dynamically generated form
The inputs should be named month[], day[], year[] and txt[] just like the checkbox is chk[]. Then for example $_POST["month"] would be an array containing the months of all the milestones in order. You should also give each of the checkboxes a unique value, for example an increasing number. Then you can loop through them like this: <?php foreach ($_POST["chk"] as $chk_value) { $id = (int)$chk_value; // The position of the milestone in the form $day = $_POST["day"][$id]; $month = $_POST["month"][$id]; $year = $_POST["year"][$id]; $txt = $_POST["txt"][$id]; // Execute query with data in $day, $month, $year and $txt } ?> Please note that this loop will only loop through the milestones which were selected with a checkbox.

Categories : PHP

Getting Dynamically Generated HTML With Nokogiri/Open URI
If reading it via open-uri doesn't produce the content you need, then chances are good that the client is generating content with Javascript. This may be good news - by inspecting the AJAX requests that the page makes, you might find a JSON feed of the content you're looking for, which you can then request and parse directly. This would get you your data without having to dig through the HTML - handy! If that doesn't work for some reason, though, you're going to need to open the page with some kind of browser, let it execute its clientside Javascript, then dump the resulting DOM to HTML. Something like PhantomJS is an excellent choice for this kind of work.

Categories : Ruby

Evaluating dynamically generated statements in Python
You want exec instead of eval. >>> s = "x = 2" >>> exec s >>> x 2 Of course, please don't use exec on untrusted strings ...

Categories : Python

How to scrape dynamically generated data in this website?
You can definitely do it with Selenium. It would be quite easy in fact. Selenium have plugins for many different programming languages, so just choose the one you know better and read Selenium documentation for that specific language. I personally use python and it is quite easy to understand. Here is the selenium documentation for Python.

Categories : Javascript

making dynamically generated menus in Pyramid
Normally I use a combination of the following patterns for this: My views are organized into classed The base class has a basic _menu which is a list of (menu_title, route_name, params) where params is an optionally present dict. When in the template I can use a menu property that builds the menu from the request and the above attribute. In the template create a function that iterates over theses entries, shows each but checks with something like has_permission if the view is actually allowed. These ideas should get you started on a dynamic solution. It works fine for me, but it might require some more tweaking, for example, I attach another value "active" to the generated menu based on the current route.

Categories : Security

Add checkboxes to a list of dynamically generated result
for (int i = 3; i < lines.Count; i++) { resultsTreeView.Items.Add(lines[i].ToString().Substring(67,17)); resultsTreeView.Items.Add(new CheckBox()); // resultsTreeView.Items.Add(BuildCheckBox()) } OR CheckBox BuildCheckbox() { CheckBox C = new CheckBox(); return C; } That's all you need to create a checkbox, or you can create a function that returns a checkbox, inside it you create a new instance of checkbox and set the attributes/subscribe to events the way you want and return it. As for the tracking which checkboxes are checked, I only need you to provide me with the type of your "resultsTreeView" EDIT : To loop through checkboxes in the TreeView and do something on the checked ones: res

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.