I want to style my Image Field Button (Choose File) with CSS. Currently, its displaying in the default theme. I am using Bootstrap V5.0.1, Django V3.2.12, Python 3.7.6.
First, I tried to identify or add a class or id which I can add and style the button regularly but was unable to add as the button was added by Django Image Field. The Code in my forms.py is given below:
from django import forms
class ImageUploadForm(forms.Form):
image = forms.ImageField(label='')
Then I used the Hover functionality of the Chrome Developer Tools to identify any leads and found that the button and its area had 2 id's #file-upload-button and #id_image.
I tried to add CSS to the above-mentioned id's but did not get the result i desired. I want to style the Choose File Button Below also if possible can i add any bootstrap to the button, any help would be appreciated! Thanks.
HTML-Django Code
<div class="form-group text-center">
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<br>
<button type="submit" id="btnUpload" class="btn btn-primary" style="margin-top:20px;">Upload</button>
</form>
</div>
i was having the same problem and came upon this article https://www.quirksmode.org/dom/inputfile.html
The ideia is to create a useless button and add style to it, then overlap both with the image field button on top, and then set the opacity of the image button to 0.
The image field button will still work, but you will only see the button with the style you add.
Related
I tried writing this code. But when i change the location and modify the code it is showing file not found.
I tried changing the code, changing the location of the file.
The button should act as link and redirect the webpage to the link provided.
If you want to use button as a link , which redirect to next page ,you can do in below 3 ways.
HTML
You can use plain HTML ,and use <form> tag where you specify the desired target URL in the action attribute.Also set CSS display: inline;
<form action="https://microsoft.com">
<input type="submit" value="Go to Google" />
</form>
CSS
You can use <a> tag in CSS
Go to microsoft
JavaScript
If JavaScript is allowed, set the location.href.
<input type="button" onclick="location.href='https://microsoft.com';" value="Go to Google" />
Hope this helps
Thanks
I know the process of creating a normal Contact Form using Dreamweaver CS6.
But for my contact form, I don't want labels like Name: Email: Message:
I want to state the label inside the textfield as initial value. When you click on the Name Textfield, the "Name" label disappears.
How do I make this effect?
You need to use the placeholder attribute in your input tag.
<input type="text" ... placeholder="First Name">
In Dreamweaver, you can find this attribute in the properties panel:
You can use place holders in the fields boxes but i do not recommend that.
here is a link.
http://www.pardot.com/faqs/forms/placeholders-and-labels/
if you dont want a label outside the input this is how it is normally achieved:
<input type="text" placeholder="Label Goes Here!">
if you notice when you input text it will dissapear and when you remove your text the placeholder will re appear!
I have built a form in Grails. I have used the g:submitToRemote button which dynamically creates a Html <input> tag. I want to apply a dojo style to it like to all other elements in my form like this <g:submitToRemote dojoType="dijit.form.Button" /> but the style doen't get applied. Can you help me out to figure the problem?
<input onclick="createLoader(); dojoType="dijit.form.Button" try{//some Ajax calls};return false" type="button" value="Search">
There are several things you need to check:
Are you sure the button is being parsed? Look at the HTML source and validate whether or not the HTML code of the button is still the same as the code you provided. When Dojo parses the HTML code it will usually change the HTML code to something more complex. If you don't have that complex code, your widget is not picked up by Dojo.
Did you import the correct CSS file? You need to make sure you imported the correct CSS file, for example claro.css.
Does any of the parent elements have the theme class name? If you use the claro theme (for example), you need to make sure you have the classname claro somewhere, usually in your body-tag.
EDIT:
More things to check:
Do you have dijit/form/Button in your require()? Assuming you're using Dojo 1.6 (because you're using the old dojoType) the code you need is:
dojo.require("dijit.form.Button");
Is your button loaded asynchronous or not? If it is loaded async, your node will not be parsed when your page loads. This means you have to async it manually by wrapping your button in a <div> and manually parse that div, for example:
<div id="toParse">
<input onclick="createLoader(); dojoType="dijit.form.Button" try{//some Ajax calls};return false" type="button" value="Search">
</div>
And in JavaScript:
dojo.parser.parse("toParse");
I am creating a macro with Excel VBA that will submit an entry into an online database using information from an Excel spreadsheet. During this entry process, the macro needs to click on a CSS button. It isn't a form button, does not have an input type, no name, no id, and no source image except for a background image. I think my only hopes are either to click on the button based on the div class. Can anyone help?
The button is here :
<div class="v-captiontext">
By Ankit
</div>
<td class="v-tabsheet-tabitemcell v-tabsheet-tabitemcell-selected" style="">
<div class="v- tabsheet-tabitem v-tabsheet-tabitem-selected">
<div class="v-caption" style="width: 39px;">
<div class="v-captiontext">
By LOT</div>
<div class="v-caption-clearelem">
</div>
</div>
</div>
</td>
Thanks to Remou's answer on this thread: Use VBA code to click on a button on webpage
Here is a first stab in your issue, you could try this:
Set tags = wb.Document.GetElementsByTagname("div")
For Each tagx In tags
If tagx.class = "v-caption-clearelem" Then
tagx.Click
End If
Next
Yet, I've never tried to use the Click method on a div.
Hi I am using jQuery UI themes and Accordion plugin. I have two html buttons in Accordion menu. A html submit input will appear when second button is clicked. But submit input looks bigger than two buttons. How can make both button and submit input look same ?
Use the jquery UI buttons feature to make it look like the rest of the UI.
Well since you are using javascript anyways you could make the submit input a button instead and submit it with javascript.
<form name="abc123" method="POST" action="me.html">
<input type="button" onclick="document.abc123.submit();"
</form>
I had similar issues with JQuery UI. What I did is changing the font size of the submit button :
<input type="submit" value="Submit" style="font-size:0.8em;" />