using an image with my existing submit button - html

I have this button that executes a php file using ajax, but it needs to use an image that has the path: src="{ROOT_PATH}mchat/form.gif" any help is appreciated thanks!
<form id="myform" method="GET" class="form_statusinput">
<input type="hidden" name="toid" id="toid" value="{mchatrow.MCHAT_USERNAME}">
<div id="button_block">
<input type="submit" id="button" value="Enter">
</div>
</form>

Use an image type input:
<input type="image" src="submit.gif" alt="Submit">
You could insert PHP into the input that like this:
<input type="image" src="<?{ROOT_PATH}?>mchat/form.gif" alt="Submit">

Related

Go to a link by using it's parameters?

I have a url and the button doesn't work right so i'm having to input the values into the url. I know it's possible to take the values and put them into the url to get to the page. How is this done? For example
<form method="get" action="https://example.url.com/courses/enrol/manual/manage.php" id="enrolusersbutton-1">
<div>
<input type="submit" value="Enroll users">
<input type="hidden" name="enrolid" value="276">
<input type="hidden" name="id" value="92">
</div>
</form>

Passing multiple values in JSP url

I am trying to pass multiple values in a JSP page url to another one.
The code is:
<form name="QuantityForm" onsubmit="return quantityValidation()" action='<%="basket.jsp?addItem="+product.PID%>' method="post">
Quantity <input type="text" name="quantity" size="5">
<input class="button button2" type="submit" value="Add to basket" />
</form>
How do i pass the value of quantity(the field of name="quantity") in the same URL? i know it's something like "Search.jsp?item=<%=search%>&item2=value2&item3=value3.." but i can't seem to structure it properly. Thanks
Do not put your ? and parameters in the action url. Put your parameters in input tags:
<form name="QuantityForm" onsubmit="return quantityValidation()" action='basket.jsp' method="post">
<input type="hidden" name="addItem" value="%product.PID%">
Quantity <input type="text" name="quantity" size="5">
<input class="button button2" type="submit" value="Add to basket" />
</form>
you're using method="post" which doesn't allow parameters to be passed into the url. change it to method="get" if you want the parameters to be passed along with the url.

add parameters to form url before submit

I need to add a path to a file to the form url before submitting. I created therefore a text field and want to add the text to the url without php.
can somebody help?
the existing code:
<form action="http://127.0.0.1:8080/WebService1/HTTPMethod_1?new_value=value" method="post">
<input type="text" value="" size="30" name="filename">
<input type="submit" name="submit" value="Submit" class="continue-button">
</form>
look into using hidden input fields. these allow you to send form data, but not necessarily show a form field.
for instance:
<script type="text/javascript">
function setFormAction() {
document.myForm.action = document.getElementById("url").value;
}
</script>
<form name="myForm" method="POST" action="default.php">
<input type="value" name="url" id="url" />
<input type="submit" name="submit" onclick="setFormAction();" />
</form>

Open a file selection dialog in a html form just to get a file name, WITHOUT uploading the file

I just want to retrieve the name of selected file without physically uploading the file. Using something like
<form method="post" action="file-upload-1.htm" name="submit" enctype="multipart/form-data">
<input type="file" name="fileField"><br /><br />
<input type="submit" name="submit" value="Submit">
</form>
will upload the file, what I want to avoid. How can prevent the upload to happen ?
Thanks for the answer,
JPS
If you don't need to submit at all, take out the form and just use an onchange in your file input like...
<input id="myId" class="button" name="myFile" type="file" onchange="getName()" >
<script>
function getName() {
alert(document.getElementById("myId").value);
}
</script>
try using some js...
<form method="post" action="javascript: getName();" name="submit" enctype="multipart/form-data">
<input id="myId" class="button" name="myFile" type="file"><br /><br />
<input type="submit" name="submit" value="Submit">
</form>
<script>
function getName() {
alert(document.getElementById("myId").value);
}
</script>

Can you keep submit=submit from showing in the URL after submitting a form?

I have a search form
<form id="search" method="GET">
<input type="text" name="q" id="q" />
<input type="submit" value="search" name="submit" id="submit" />
</form>
and when I submit it it adds ?q=&submit=submit to the URL is there a way that I can keep it from appending submit=submit but still pass the q=?
If you remove the name attribute from your <input type="submit" /> then that should get rid of submit=submit from the querystring (a quick test in Firefox / Firebug confirmed this). For example:
<input type="submit" value="search" />
Try using a button:
<button type="submit">Submit Form</button>
Would using post instead of get be out of the question because that wouldn't show anything in the url.
Change the button's name to name=''
Change the button type from:
type="submit"
To:
type="button"
i.e.
<button type="button">Login</button>
You could just use an anchor instead of a form input:
<script type="text/javascript">
function submitForm() {
document.getElementById('search').submit();
}
</script>
<form id="search" method="GET">
<input type="text" name="q" id="q" />
Submit
</form>
Or, you could add an onsubmit to the form, and use javascript to disable the input field, which should keep it from showing in the URL.
No. You would need to remove the input.