w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Django Crispy Forms, Twitter Bootstrap, and Formsets with form-inline
I was able to replicate this issue as well. While I am not 100% certain as to the behavior, I was able to find the following in the django-crispy-forms documentation: #forms.py def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.form_action = '.' self.helper.form_class = 'form-inline' self.helper.template = 'bootstrap/table_inline_formset.html' self.helper.add_input(Submit('submit', 'Submit')) super(SurveyForm, self).__init__(*args, **kwargs) # views.py from django.views.generic.edit import FormView from .forms import SurveyFormset, SurveyForm class Survey(FormView): form_class = SurveyForm template_name = 'survey.html' def get(self, request, *args, **kwargs):

Categories : Django

Wrap each form in formset with a div including unmentioned fields with django crispy forms
As Brian Dant suggested, ORDER and DELETE should be added manually if they are to be included in the Layout. My problem was that I also passed them to the Meta class's `fields'. class _OperatorForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(_OperatorForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_tag = False self.helper.layout.extend(['ORDER', 'DELETE']) self.helper.all().wrap_together(Div, css_class="operator-form") class Meta: model = ApplicationOperator fields = tuple(fields_list)

Categories : Django

Django crispy forms not loading CSS
You need to include the css/js yourself. So... Download bootstrap, put the files in your static files directory, include a link to the bootstrap css/js files in your base.html template, then you will be able to see the proper formatting.

Categories : Django

Using HTML in Crispy Forms formset
I'm the lead developer of crispy-forms The problem here is that you are using bootstrap/table_inline_formset.html which currently doesn't support specifying a layout. It's stated clearly in the docs: http://django-crispy-forms.readthedocs.org/en/latest/crispy_tag_formsets.html#custom-templates-and-table-inline-formsets This template doesn’t currently take into account any layout you have specified and only works with bootstrap template pack. I'm aware this is not the expected behavior and there is an open issue about it. I'm hopefully working this week on solving it somehow.

Categories : Django

Crispy Forms Initial data
Nothing to do with crispy-forms, this is regular Django forms code. You have forgotten to call parent constructor, if you are using python 2.X do: def __init__(self, *args, **kwargs): super(YourFormClassName, self).__init__(*args, **kwargs) self.fields['medical_record_number'].initial = 'whatever you want' Beware that maybe you prefer to set initial in your Django form field: whatever = forms.CharField(initial="whatever you want")

Categories : Django

Construct crispy forms layouts iteratively?
In your question: "Note: the length of the form is not known beforehand." We can indeed find the length of a form beforehand: >>> import apps.students.models as models >>> from django.forms.models import modelform_factory >>> form = modelform_factory(models.StudentProfileBasics) >>> len(form.base_fields.keys()) 5 From there, the combination of a) Crispy's ability to modify layouts on the go by grabbing slices of a layout, b) the wrap method that Crispy provides, and c) the list provided by forms.Form.base_fields.keys() should get you where you need to be!

Categories : Django

Twitter bootstrap and crispy forms confusion
Twitter bootstrap is something completely different than crispy-forms: Twitter bootstrap is a CSS and Javascript presentation framework. You can use it to generate your html pages from any framework, not just Django! You can use it to define how your html will be layout in a grid and also it has styles for a number of html components. Crispy-forms is a Django application that can be used to create better layouts for forms. What it does is that you can define programatically how you want your form to be rendered (instead of doing it in the template with html). You should use it if you want to have really nice looking forms without too much hassle. The only relation between the two is that crispy-forms actually can render your form using bootstrap layout, meaning that the styles and class

Categories : Django

Django crispy forms work with custom widgets?
No, this won't be possible because crispy forms never calls the render method of the widget. An alternative is to override the template for the widget, in this case bootstrap/layout/checkboxselectmultiple.html, to use the grouping as required. https://github.com/maraujop/django-crispy-forms/blob/dev/crispy_forms/templates/bootstrap/layout/checkboxselectmultiple.html

Categories : Django

Is it posibble to use django-crispy-form FormHelper without modifying Form class
I'm not sure why do you need to use {% crispy form %} and not just the crispy filter. I'm using crispy in my login form, overriding the template from django.contrib.auth, this way: {% load crispy_forms_tags %} {% block body %} <form method="post" action="" class="form-signin">{% csrf_token %} {{ form|crispy }} <div> <button type="submit" class="btn btn-primary">{% trans "Log in" %}</button> </div> </form> {% endblock %}

Categories : Django

Django Crispy form define a class for the form field
You could try to resolve this problem using CSS. For your form class: class ConfirmationForm (forms.Form): def __init__(self, *args, **kwargs): self.helper = FormHelper() # set form class is well documented self.helper.form_class = 'form-special' super(ConfirmationForm, self).__init__(*args, **kwargs) Then add some a CSS rule: .form-special input[type="radio"] { /* whatever you want */ } You can even find this way more neat and less cumbersome.

Categories : Django

In Django Crispy Form how i can use `layout.append(HTML("

whatever

"))`
super(PostJobForm, self).__init__(*args, **kwargs) must place below init object. and add self to function FormHelper(). class PostJobForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(PostJobForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_tag = False

Categories : Misc

Django Crispy Form Split Field Layouts
create a form.py from crispy_forms.helper import FormHelper from crispy_forms.layout import Field,Layout, ButtonHolder, Submit class layout1Form(forms.Form): def __init__(self, *args, **kwargs): super(layout1Form, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( Field('answer',css_class="field span8"), ButtonHolder( Submit('submit', 'Submit', css_class='btn-primary pull-right') ) ) self.helper.form_tag = False class layout2Form(forms.Form): def __init__(self, *args, **kwargs): super(layout1Form, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.layout = Layout( Field('answer',css_cl

Categories : Python

Opaque panel, over the top of other controls on form, some controls are drawing over it thought?
Try the .BringToFront() method on the panel, or the .SendToBack() on the controls that are over your panel. See MSDN Documentation. Usually, when you add a new control, its added in front of every other control of that parent.

Categories : C#

How to downgrade Form(FMB) created/modified in Forms 10g to Oracle Forms 9
I don't have a copy of Forms developer 10g or 9i so this answer has not been tested. Have you tried converting the Forms created in Forms 10g into XML using the supplied Oracle tools? Once you have the XML incarnation of your Form you may be able to convert it back into an Oracle Form 9i .fmb file. However I am sure that even if this works, Oracle only support "forward", i.e. 9 to 10 upgrades so if yo start getting strange errors you will be on your own! Myself, I would do the changes from the begining in the lower version.

Categories : Oracle

web user controls in asp.net Mvc 4 application just like web forms
In MVC - there are not any built in controls like you are used to seeing in WebForms (DataGrid, BreadCrumb, etc). These WebForm controls relied on concepts that do not exist in the MVC framework such as ViewState and PostBack. There have been many discussions around the use of WebForms vs MVC, web controls and lack thereof, but this is not the place for those. You can build your own (using partial views for instance) or look at the third party components (Telerik).

Categories : C#

Two forms from one model both forms validate when one form is submittted
First, why are you doing this <?php $contactforms = $this->requestAction('Contactforms/contact') ?> in your element? I don't see the use of that requestAction except slowing down the processing... Ok, but your problem... Since you're calling an element, there's no easy way to avoid the validation of both forms. Usually, when there are two forms corresponding to the same model, the way to not validate both is to change the "name" of the form like this <!--in the first form--> <?php echo $this->Form->create('Contactform1'); ?> <!--in the second form--> <?php echo $this->Form->create('Contactform2'); ?> But, since you are creating that form with an element, there's no easy way of changing the name of the form in one place and not in the o

Categories : Cakephp

PHP - Generating several forms, but the forms only ever output the same thing for each form
you missed </form>. Try this. printf("<div class='NewsItem'><div class='title'>%s</div><form enctype='multipart/form-data' action='tutorial.php' method='post'><input type='hidden' name='tutorial' value='%s'/><input type='submit' name='submit' value='%s' id='hyperlink-style-button'/></form></div>", $row['Title'], $row['Title'], $row['Title']) I cannot see any other critical problems, try the following. I have removed enctype='multipart/form-data' also it is not valid to have more than 1 items with same id in a page so changed id="hyperlink-style-button" to class="hyperlink-style-button". you have to change the css accordingly. Also replaced single quotes to double quotes and added htmlspecialchars for values to not break html on quote

Categories : PHP

How do I copy a control between forms and still maintain child controls?
in the form you want to copy the control to try this: Dim tc As New TabControl tc = New Form1().TabControl Me.Controls.Add(tc) The tabcontrol should be copied to the other form with all the properties intact.

Categories : Vb.Net

How can I get two controls on separate forms bound to the same datasource to update each other?
INotifyPropertyChanged is the mechanism for automatic refreshing in .NET, so that is what you need to implement if you want your form to automatically update in response to the bound data changing. If you have a UI control bound to a data source, there are two ways for the UI control to get updated: UI control polls the data source every time period T Data source notifies the UI control when something changes Polling is bad for performance reasons. INotifyPropertyChanged is the mechanism by which data sources notify UI controls of changes.

Categories : C#

Are there any way to create .net user controls for the purpose of using them on delphi forms?
There is at least one way, and that is to host the .NET runtime into the Delphi application. You can check out the JCL classes which has code to do this hosting. Once you've done that, you can ensure your control classes are ComVisible by tagging them with the attribute: [ComVisible] public class SomeControl : UserControl Then you'll have to construct the control from Delphi, how to do this via the JCL system I don't know as we've created our own wrappers. You should really check out the JCL classes for more details here. There are some problems, however: Resizing doesn't always work, sometimes you'll have to handle the resized event in Delphi, and then manually ask the .NET control to resize itself accordingly Tabbing between textboxes doesn't always work, specifically Delphi code

Categories : Dotnet

How to use the Controls and Forms of Visual Studio to access the TFS Version Control
It is possible, the following I used for TFS2010 and found it somehwere in the internet, it opens the SourceControlFileSelector: VersionControlServer versionControlServer = (VersionControlServer)tfsConnection.GetService(typeof(VersionControlServer)); Assembly controlsAssembly = Assembly.GetAssembly(typeof(Microsoft.TeamFoundation.VersionControl.Controls.ControlAddItemsExclude)); Type vcChooseItemDialogType = controlsAssembly.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogChooseItem"); ConstructorInfo ci = vcChooseItemDialogType.GetConstructor( BindingFlags.Instance | BindingFlags.NonPublic, null, new Type

Categories : Dotnet

Save/load controls made inside C# windows forms
They say not to reinvent the wheel but you could do this a countless number of ways. It really depends on the style, format, and audience of the user. Sometimes I like to do everything in a simple txt style file this way anyone can easily edit the information. XML will offer you the ability to more easily organize your information which probably will be better. It really is up to you, I would say whatever you are more comfortable with. I personally would make my own little algorithm to search a plain txt file but that is because I am not using XML. You should create a Class just for handling saving and loading the file. Something like public class CustomControls { //more code public void AddCustomControl(Control x) { } public void RemoveCustomControl(

Categories : C#

Making Thread-Safe Calls to labels in Windows Forms Controls
You need to modify the delegate to take a Label in addition to the string: delegate void SetTextDelegate(String^ text, Label^ label); And then call it with two parameters: void SetText(String^ text, Label^ label) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (label->InvokeRequired) { SetTextDelegate^ d = gcnew SetTextDelegate(this, &Form1::SetText); this->Invoke(d, gcnew array<Object^> { text, label }); } else { label->;Text = text; } }

Categories : Multithreading

Form controls visual changes on starting form
This is the XAML that produces an output similar to what you depicted: <Window x:Class="MiscSamples.Layout" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Layout" Height="300" Width="300"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height=".5*"/> <RowDefinition Height="Auto"/> <RowDefinition/> <RowDefinition Height=".5*"/> </Grid.RowDefinitions> <Button Grid.Row="0" Gr

Categories : Dotnet

MVC2 c# multiple forms in table. One form overwriting other form elements on postback
When model binding to a list you need to append a unique identifier to each row, in order to keep the generated id's unique. Here is an example using a for loop rather than a foreach (its written in old school asp views, not razor) <%@ Page Inherits="ViewPage<IList<Book>>" %> <% for (int i = 0; i < 3; i++) { %> <%: Html.TextBoxFor(m => m[i].Title) %> <%: Html.TextBoxFor(m => m[i].Author) %> <%: Html.TextBoxFor(m => m[i].DatePublished) %> <% } %> This will generate textboxes with unique id's allowing you to post back multiple items in a single form. You're obviously trying to make multiple forms, which could still work, just give each form a unique id. Take a look at phil haacks classic article o

Categories : C#

Winforms Form Inheritance - inherited forms not updating when base form is changed
This will happen when you have the derived form opened in the designer. Which remembers the size is had. If you then modify the base form and rebuild then the designer will notice the derived form is no longer the same size as the base form and will record the size. You'll now have a permanent mismatch. You avoid it by making sure the derived form isn't opened when you edit the base form. And that the base form is recompiled before you open the derived form. But, accidents are definitely going to happen, best to not rely on it. And in the greater scheme, the size should be left up the user anyway. You can fix it by right-clicking the derived form's Size property in the Properties window and clicking Reset.

Categories : Vb.Net

sending 'this' as parameter from web controls to javascript functions
You don't need a separate JavaScript function, just use this.click(): <asp:LinkButton onfocus="this.click()" id="lnk_home" runat="server" AccessKey="h" onclick="lnk_home_Click">Home</asp:LinkButton> Or if you do want to use a separate function (perhaps to perform some common routine on multiple LinkButtons) invoke click method on passed object itself: <asp:LinkButton onfocus="postBack(this);" id="lnk_home" runat="server" AccessKey="h" onclick="lnk_home_Click">Home</asp:LinkButton> <script type="text/javascript" > function postBack(oLink) { // some common code oLink.click(); }; </script> UPDATE When you actually click the link with the mouse - event may fire twice, so you need to limit it to one click: <asp:LinkButton o

Categories : Javascript

How to create two forms: (login form, register form) and they submitted to my component.and admin has to approve registred user in joomla
You can use default User Manager com_users in Joomla , You just need to create a menu then assign the Menu Item Type to Login Form/Registration Form under the user manager list and enter the further details and just save it. More detail you can find here : Help25:Users User Manager Help25:Menus Menu Item User Login Help25:Menus Menu Item User Registration Hope this will help you.

Categories : Joomla

ASP.NET Web Forms - error message with parameter like in ASP.NET MVC
The RequiredFieldValidator is an ASP.NET validation control that validates a single field (ControlToValidate property). That means the message you define for one of these validators should be just the specific message for the field being validated. In this case: <asp:TextBox ID="Email" Text="E-mail" runat="server" Width="300px" /> <asp:RequiredFieldValidator ID="RequiredEmailValidator" runat="server" ErrorMessage="Field E-mail is required." ControlToValidate="Email" Display="Dynamic"></asp:RequiredFieldValidator> <asp:TextBox ID="UserName" Text="User Name" runat="server" Width="300px" /> <asp:RequiredFieldValidator ID="RequiredEmailValidatorUN" runat="server" ErrorMessage="Field User Name is required." ControlToValidate="UserName" Display="Dynamic"></asp

Categories : Asp Net

Put forms.DateField parameter into view method
It's in form.cleaned_data: You can access it by doing: objects = list(repo.find_objects(date__gt=form.cleaned_data['date_from'])) This is assuming that your form declaration looks something like: class AdvancedSearchForm(forms.Form): date_from = forms.DateField(...) ...

Categories : Python

Put controls on a form border in vb.net?
I'm not sure if you can override the drawing of the border and if you could not sure how you would add control to the border. You can temporarily change the border style before you maximize the form. And you can overload the client event to handle re-sizing the form yourself. Are there any other reasons you dont want to go with Formborderstyle.none? Public Class Form1 Inherits Windows.Forms.Form Private Const BorderWidth As Integer = 30 'This is just for demo purposes. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Panel1.Location = New Point(Me.Width - BorderWidth, 0) Panel1.Width = BorderWidth End Sub Public xLocation, yLocation As Integer Private Sub Panel1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEve

Categories : Vb.Net

Too many vlc activeX controls on form crashes app
you need more server and memory space to get more than 25 videos in single screen, your local machine with i7 processor does not help you to resolve this issue. i know VLC is best video development kit, and this is the only kit that can give you more video than others in single screen with low memory and CPU utilization. Best wishes to get resolve this issue ASP, and post the article if you resolve this issue

Categories : C#

asp:controls transfromations from html form
That particular element would actually be a TextBox MSDN TextBox It would look like this <asp:TextBox runat="server" ID="Email" CssClass="contact-form" />. this would then render <input type="text" id="_Email" class="contact-form" /> The Literal control doesn't produce an HTML element and allows you to add text/html to your page and not wrap it in any other HTML. The Label control actually outputs a <span></span> and puts your Text in between it.

Categories : C#

C# highlight part of form over controls
Maybe you should consider doing all this (creating graphs, etc.) via Graphics instead of Controls! In that case you would have full control over event handling, highlighting, and so on. I do not think there is a clean way to achieve what you want by using controls only.

Categories : C#

How to make a class to hide your controls in your form in c#
You're creating a whole class just to show/hide some controls? You can use these methods instead: public static void ShowControl(Control c) { c.Show(); } public static void HideControl(Control c) { c.Hide(); } Or, if you want to put it in a whole new class (which I don't recommend) public static class ControlsUtility { public static void ShowControl(Control c) { c.Show(); } public static void HideControl(Control c) { c.Hide(); } } Hope that helped.

Categories : C#

Manipulating dynamic controls c# form application
You can declare an array of Panel, then loop through that array to add each pannel into UI And when you want to access one of them, just access it through the array. By this way, you don't have to "Find" the control, but directly access it through Index of array.

Categories : C#

Print windows form to PDF with controls that use scrollbars? C#
You will need to take a screen shot and use that image to generate a pdf. The only way I have seen this done is using a program called Snagit, which scrolls the application window automatically whilst capturing it and I assume stitches that together. I would imagine you would need to do that programatically to get the output you need?

Categories : C#

How to access TPanel child form controls?
The main problem is, that you create 2 instances of TForm2. Your .dpr file look like this begin Application.Initialize; Application.CreateForm( TForm1, Form1 ); Application.CreateForm( TForm2, Form2 ); Application.Run; end. After you create an instance of TForm2 in TForm1.OnCreate and save this instance into global variable Form2, another instance of TForm2 is created and stored into Form2. In the TForm1.btn5.OnClick event you address the second created, non visible TForm2. Solution go to Project / Options -> Formula and remove TForm2 from AutoCreate List store the instance of TForm2 created inside of TForm1 in a private class field of TForm1 Your code should look like this .dpr file: begin Application.Initialize; Application.CreateForm( TForm1, Form1 ); Applica

Categories : Forms

Find components on a windows form c# (not controls)
Surprisingly, it seems the only way to do this is via reflection. private IEnumerable<Component> EnumerateComponents() { return from field in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where typeof (Component).IsAssignableFrom(field.FieldType) let component = (Component) field.GetValue(this) where component != null select component; }

Categories : C#

How to Access MdiParent Controls From Child Form C++ .NET
If enyone will have the same problem, I found the answer. You will need to use the MdiChildActivate event of the parent form. This event will appear when the child is created and when the cild is closed, to resolve this probleme, use this code: Create a private varible outside the function set on 0: private: static int closeChild = 0; In private: System::Void Form1_MdiChildActivate(System::Object^ sender, System::EventArgs^ e) use this code: closeChild++; String ^ childName = this->MdiChildren[0]->Text; if(closeChild == 2) menu_open->Enabled=true; closeChild will be 2 on closing. And don't forget to reset closeChild to 0 when a new child is created becouse closeChild will increment to 3, etc.. Good luck !

Categories : C++



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