EDIT: This seems to be due to the file itself and possibly where it is stored on the machine (it's on a mounted volume). It is unlikely to be related to the form or Django, since other files work as expected.
I have a pretty simple HTML page with a form which is behaving very strangely:
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta name="generator" content=
"HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
<title>Add picture</title>
</head>
<body class="app-products model-picture change-form">
<!-- Container -->
<div id="container">
<!-- Header -->
<div id="header">
<div id="branding">
<h1 id="site-name">administration</h1>
</div>
</div><!-- END Header -->
<!-- Content -->
<div id="content" class="colM">
<h1>Add picture</h1>
<div id="content-main">
<form enctype="multipart/form-data" action=
"/admin/products/picture/add/" method="post" id="picture_form"
novalidate="" name="picture_form">
<div>
<fieldset class="module aligned">
<div class="form-row field-alt_text">
<div>
<label class="required" for="id_alt_text">Alt text:</label>
<textarea class="vLargeTextField" cols="40" id="id_alt_text"
name="alt_text" rows="10">
</textarea>
</div>
</div>
<div class="form-row field-original_image">
<div>
<label class="required" for="id_original_image">Original
image:</label> <input id="id_original_image" name=
"original_image" type="file">
</div>
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="Save" class="default" name="_save">
<input type="submit" value="Save and add another" name=
"_addanother"> <input type="submit" value=
"Save and continue editing" name="_continue">
</div>
</div>
</form>
</div><br class="clear">
</div><!-- END Content -->
<div id="footer"></div>
</div><!-- END Container -->
</body>
</html>
It is being served up by a django application as a static file (to keep things simple).
When I click the "Save" button to submit the form without filling it out at all (or if I put some text in the textarea), I see a POST request go through to the django application as expected. However, if I choose a file with the "file" input and then try to submit the form, no POST request reaches the application. In fact, no request is sent (I'm watching the HTTP traffic in wireshark). In Google chrome, I see the following error page:
Any ideas?
Are the name of your inputs separated by a white space?
name= "myinputname"
If so, the form will not process.
Related
I am using sublime text editor for web development coding. Recently when i was editing a code all the lines of file got shuffled like the one in code. this is happened with all of my files even with all the previous html and css files. Any one who can help me to get back to correct sequence. I don't want to do it manually as the file is too large to edit again.
<div ><input type="password" name="password" placeholder="password" class="input"></div>
<div ><input type="submit" name="login" value="Submit" class="input button"></div>
<div ><input type="text" name="username" placeholder="username" class="input"></div>
</form>
<a href="register.html">Sign Up
<form >
</div>
</div>
<div class="container">
<div class="heading"><h1>Login</h1></div>
<div>Not a member?
</div>
<div class="login-form">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Login</title>
<!DOCTYPE html>
</body>
</head>
</html>
<body>
<head>
<html>
Just Ctrl+Shift+P (or Command+Shift+P on MacOS) to open the tools pallet, type reindent , and pick Indentation: Reindent Lines .
Hi so I am trying to make a search bar that queries a database in MySQL using a product number and when the item is found, its relevant numerical values underneath the headings ("Item Cost", "Taxes", etc) are put into the form boxes to be used as input for my HighCharts graph. That was a long sentence, sorry, hopefully my JSFiddle will explain what I mean!
I have a bit of experience with Python and in my college course was taught how to make a self-processing page using it but I couldn't get it to work and since the only results online for this sort of thing were for PHP I said I'd give that a go instead!
I used PHP to conduct a search on the database originally but when hitting search it went to a 2nd page so I'd prefer it be done on the same page
JSFiddle
Side question: How would I set the reset button to reset the values to 0 in the boxes? (It's okay if this is too much, I can figure it out myself I'd say)
Thanks in advance!
It asks me to include indented code as I have a JSFiddle link so here:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pricer.ie</title>
<link rel="stylesheet" href="homepage.css"/>
<link href="https://fonts.googleapis.com/css2?family=B612&display=swap" rel="stylesheet">
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="/js/themes/gray.js"></script>
<script src="highcharts.js"></script>
<meta name="viewport" content="initial-scale=1.0, width=device-width"/>
</head>
<body>
<nav class="navbar">
<ul>
<li class="logo">
<img src="logopricerv2.png" alt="logo" id="logo" >
</li>
<li>
<a href="login.py" class="logintopright" >Login</a>
</li>
<li>
<a href="logout.py" class="logouttopright" >Logout</a>
</li>
<li>
<button class="darkmodebutton" onclick="darkFunction()">Toggle dark mode</button>
</li>
</ul>
</nav>
<main>
<figure class="highcharts-figure">
<div id="container" style="width:100%; height:400px;"></div>
<script>
</script>
</figure>
<section>
<form action="search.php" method="POST" id="search_form" autocomplete="off">
<label for="query">SKU : </label>
<input type="text" id="query" name="query"><br><br>
<input type="submit" id="search_box" value="Search">
</form>
</section>
<section>
<form id="mainForm" autocomplete="off">
<label>Item Cost:</label>
<input type="number" id="icost" name="icost" step="0.01"/><br><br>
<label>Shipping Cost:</label>
<input type="number" id="scost" name="scost" step="0.01"/><br><br> <!-- names and ids are incorrect just like this for now -->
<label>Taxes:</label>
<input type="number" id="taxes" name="taxes" step="0.01"/><br><br> <!-- shouldnt exist as taxes is from database but sure look-->
<label>Listing Fee:</label>
<input type="number" id="listfee" name="listfee" step="0.01"/><br><br>
<label>Profit Margin:</label>
<input type="number" id="pmargin" name="pmargin" step="0.01"/><br><br>
<input type="submit" value="Reset">
<input type="submit" value="Save Changes">
</form>
</section>
</main>
<footer>
</footer>
</body>
</html>
Easier to understand in the JSFiddle
I'm a beginner and I'm using HTML to embed aspects onto google sites. forgive me if my title wasn't specific or my question is idiotic.
this is my code:
<div class="wrapper">
<form class="form1" action= "sites.google.com" onsubmit="return (this.pass.value==='1291')?true:false;">
<div class="formtitle">Enter the password to proceed</div>
<div class="input nobottomborder">
<div class="inputtext">Password: </div>
<div class="inputcontent">
<input type="password" name="pass" />
<br/>
</div>
</div>
<div class="buttons">
<input class="orangebutton" type="submit" value="Login" />
</div>
the problem is it will redirect me to the other page on a new tab that it opens is there any way to keep it on the same tab?
another problem is that it will show the password in the URL is there any way to prevent that?
thanks for your help
I just want that when I press Submit button to get me to the <div id="Home> where the other code will be.
This is my work:
<!DOCTYPE html>
<head>
<title>MyWebsite</title>
</head>
<body>
<div id="Start" align="center">
<h1 style="color:red">My</style><span style="color:blue">Website</span></h1>
<hr/>
Name:<br/>
<input type="text" name="username"><br/>
Password:<br/>
<input type="password" name="password"><br/><br/>
<form action="Home">
<input type="submit" name="continue" value="Continue">
</form>
</div>
<div id="Home" align="center">
<p>Hello world!</p>
</div>
</body>
You need some PHP (or other server side language) between your form and the div below it. Otherwise you're just refreshing the page when you hit submit.
You could also use javascript/jQuery.
Try doing one or both of the above and then come back for help if you have trouble.
I have two html pages.
I enter to the first page, press the button and go to the second page.
The problem is that when Im in the second page (signin.html) and I press the back button from the browser I dont go to the first page (welcome.html) I go to some other previous page. I need to be able to go back by pressing that button, how can I achive that?
html 1 welcome.html
<HTML>
<HEAD>
<TITLE>
Welcome page
</TITLE>
</HEAD>
<BODY>
<div>
<div class="button">
<input name="account" type="button" value="I am a service provider" onclick="window.location.replace('/member/sign-in.html')"/>
</div>
</BODY>
</HTML>
html 2 signin.html
<HTML>
<HEAD>
<TITLE>
Member sign in
</TITLE>
</HEAD>
<BODY>
<form id="myform" action="/my-code/signInMember.php" method="post">
<div>
<label for="spEmail">E-mail:</label>
<input type="email" id="spEmail" name="spEmail" required/>
</div>
<div>
<label for="spPswd">Password:</label>
<input type="password" id="spPswd" name="spPswd" required/>
</div>
<div class="button">
<button type="submit" name="submit">Sign in</button>
</div>
<div class="button">
<input name="submit" type="button" value="sign up for free" onclick="window.location.replace('/member/create-account.html')"/>
</div>
<div/>
</form>
</BODY>
</HTML>
Any ideas? I was looking around and everybody say to add a button to go back (with php or javascript) but I dont want that. I want to press the browser button and then go back, no with a button in the page itself.
Thanks, any help will be appreciated.
onclick event rather than using "window.location.replace('/member/sign-in.html')" use "window.location.href='/member/sign-in.html'" or "window.location.href='member/sign-in.html'" according to your path of destination html.
thanks, I changed as suggested:
<form>
<input TYPE="button" VALUE="Offer this service"
onclick="window.location.href='/member/signin.html'">
</form>
And it worked!