posting input tag in hebrew - html

I am sending in the fileName a hebrew word "הי"
and it return "??"
really need help on this,
thanks for the helpers!
for encoding I added the top of this html lines :
<%# page language="java" contentType="text/html; charset=windows-1255"
pageEncoding="windows-1255"%>
JSP:
<form name='DMform' id='DMform' style="height: 226px; " method="Post" >
<center>
<h2 id="titleID">title </h2>
<input type="button" value="button1" style="width: 116px; " onclick="setTextOnFile()">
<input type="text" name="filePath" id="filePath" style="width: 258px;" value="<%if(filePath!=null){
out.println(filePath[0].trim());
}%>" >
</br></br>
<input type="text" name="fileName" id="fileName" style="width: 258px;" value="<%if(fileName!=null){
out.println(fileName[0].trim());
}%>" >
<label>: שם המסמך </label>
</br></br>
<input type="button" value="send" onclick="checkData();" <%if(filePath!=null){
if(filePath[0].trim()!=""){ out.println(" disabled ");}
}%> >
</br></br>
<input type="button" value="איפוס הטופס" onClick="window.location=window.location.href ;">
</center>
</form>
Java script that past:
function checkData(){
document['DMform'].submit();
}

Related

How to display an onSubmit that results in a URL in an iframe on the same website?

I created a form in which you can enter a text
With onSubmit, this text creates a URL
I would like to have this website opened in an iframe on the same page where the form is.
What I've done:
<form onsubmit= "location.href = 'http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=' + score.value + '&ftab=FeedbackAsSeller'; return false; target="eBay";">
<input type="text" name="score" placeholder="Copy Seller ID here"> <input type="submit" value="Enter/Click">
</form>
<iframe name="eBay"src="" width="90%" height="90%"></iframe>
I supposed that the target attribute would do the trick, but I still get redirected to the generated URL. What am I doing wrong? Thanks for any help :)
I have put whole code
<html>
<head>
<title>Please Rate if it helps</title>
<!-- PUT A PATH OF JQUERY LIBRARY -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script>
function onSubmitCallIt() {
$("#eBay").attr("src", 'http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=' + score.value + '&ftab=FeedbackAsSeller');
}
</script>
</head>
<body>
<form>
<input type="text" id="score" name="score" placeholder="Copy Seller ID here">
<input type="button" value="Enter/Click" onclick="onSubmitCallIt();">
</form>
<iframe id="eBay" name="eBay" src="" width="90%" height="90%"></iframe>
</body>
</html>
Rate, If it helps...
function openWin(){
alert("in func");
var frame=document.getElementById("iFrame");
var sellID=document.getElementById("score").value;
var win="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=" + sellID + "&ftab=FeedbackAsSeller";
frame.src=win;
alert("done");
}
<form onsubmit="openWin()">
<input type="text" name="score" id="score" placeholder="Copy Seller ID here"> <input type="submit" value="Enter/Click">
</form>
<iframe name="eBay"id="iFrame" src="" width="90%" height="90%"></iframe>

System.Web.Mvc.Html.MvcForm Razor show me a HTML

I have a form in a View.
#if (Request.IsAuthenticated) {
#(Html.BeginForm("LeaveComment", "Publication")){
<input type="text" name="pub" style="display: none" value=#publication.PublicationID>
<input type="text" name="mail" style="display: none" value=#Context.User.Identity.Name>
<textarea id="comment" name="comment"></textarea>
<button type="submit">Submit</button>
}
}
The view show me "System.Web.Mvc.Html.MvcForm":
The method of controller is :
public ActionResult LeaveComment(int pub, string mail, string comment)
How can I solve it?
EDIT
If I use #using this work well but this crash another Form. The code of the other Form is the next :
#if (Request.IsAuthenticated)
{
using(Html.BeginForm("LeaveComment", "Publication", FormMethod.Post,
new { publicationID = publication.PublicationID, mail = Context.User.Identity.Name }))
{
<textarea id="comment" name="comment" style="width: 828px; margin-left: 18px;"></textarea>
<button type="submit" name="action:LeaveComment" value="LeaveComment" class="btn btn-default pull-right">
<strong>Submit</strong>
</button>
}
}
else
{
<form action="#">
<textarea id="comment" name="" style="width: 828px; margin-left: 18px;"></textarea>
<button type="button" href="#login" data-toggle="modal" data-target="#login-modal" class="btn btn-default pull-right" style="margin-right: 15px;">
Submit
</button>
</form>
}
UPDATE
I resolve this problem adding using in the leave comment and I deleted the field FormMethod.Post of this post.
You need to use using (Html.BeginForm(...)), as MvcForm.Dispose() will print the actual end form tag.
Your code #(Html.BeginForm) will call MvcForm.ToString(), which will just print the type name.

Forms: Using 1 input box with 2 names

my first post here so hope its not too dumb a question. Im including a search box in my nav bar and I want it to search by product title OR description, is this possible ? The code I have so far is as follows which works fine to search by one field but not two
<div class="search_box">
<form method="post" name="search" id="search" action="../admin/search_box.php">
<input type="submit" name="submit" value="Find" style="float: right" />
<div style="overflow: hidden; padding-right: .5em;">
<input type="text" name="description" style="width:100%;" />
</div>
</form>
</div>
and then for the data processing
<?php
require ('dbconnection.php');
$title = filter_var($_POST["title"], FILTER_SANITIZE_STRING);
$description = filter_var($_POST["description"], FILTER_SANITIZE_STRING);
if (isset($_POST['submit'])) // waits for user to enter data into the form
{
$sql_search_lookup = "SELECT * FROM item WHERE item.description LIKE '%$description%'";
$result=mysqli_query ($link, $sql_search_lookup) or die ('Problem:'.$sql_search_lookup);
if (mysqli_num_rows($result) > 0)
{
while ($row=mysqli_fetch_array($result))
{
?>
<div style="float: left; width: 98%; margin: 10px">
<p>
<div style="float:left; width: 20%;">
<a href="/products_detail.php?itemID=<?php print $row["itemID"]?>">
<img src="../images/products/<?php print $row['img_file_path'];?> " width="150" height="120">
</a>
</div>
<div style="float:left;width: 75%;vertical-align:middle; font-size:14px; padding:1%;">
<?php echo "Title: ". $row['title']?><br>
<?php echo "Description: ".$row['description']?>
</div>
</p>
</div>
<?php }
}
else
{
echo "We cant find what you're looking for sorry";
}
}
?>
Your HTML should be:
<div class="search_box">
<form method="post" name="search" id="search" action="../admin/search_box.php">
<input type="submit" name="submit" value="Find" style="float: right" />
<div style="overflow: hidden; padding-right: .5em;">
<input type="text" name="description" style="width:100%;" />
</div>
</form>
</div>
Your mysql query should be something like:
$sql_search_lookup = "SELECT * FROM item WHERE item.description LIKE '%"+$description+"%' or item.title LIKE '%"+$description+"%'";

Populate data on same window

Hi, my requirement is to populate the data on same window where i have provide the employee id , Employee Id button and input field is present on left corner the of window and i want to populate the data on right corner of window as shown on figure right now i m population data on different window please help me out .
Here is my JS
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%# taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<jsp:include page="Header.jsp" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="../css/style1.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="1255" height="952" border="0">
<tr>
<td width="357" height="251" bgcolor="#CC6600">
<table width="285" border="0" align="center" bgcolor="#FF9900">
<c:if test="${requestScope.x}">
<div id="div3">
<form:form commandName="departmentForm"
action="/EmployeeWebAppUI/DepartmentController/findbydepartmentid">
<span>Find By ID </span>
<form:input path="departmentId" />
<input type="submit" name="submit1" value="search" />
</form:form>
<br>
</div>
</c:if>
<c:if test="${requestScope.y}">
<div id="div1">
<form:form commandName="departmentForm"
action="/EmployeeWebAppUI/DepartmentController/findbydepartmentname">
<span>Find BY Name</span> <form:input
path="departmentName" />
<input type="submit" name="submit" value="search" />
</form:form>
</div>
</c:if>
<c:if test="${requestScope.w}">
<div id="div2">
<form:form commandName="projectForm"
action="/EmployeeWebAppUI/ProjectController/getprojectsbyId">
<span>Employee Number: </span>
<form:input path="employeeNumber" />
<input type="submit" name="submit2" value="search" />
</form:form>
<br>
</div>
</c:if>
<c:if test="${requestScope.A}">
<div id="div2">
<form:form commandName="employeeForm"
action="/EmployeeWebAppUI/EmployeeGetController/findbyid"
method="get">
<span>Employee Id:</span>
<form:input path="employeeNumber" />
<input type="submit" name="Search" value="Search" />
</form:form>
</div>
</c:if>
<c:if test="${requestScope.B}">
<div id="div1">
<form:form commandName="employeeForm"
action="/EmployeeWebAppUI/EmployeeGetController/findbyname"
method="post">
<span>Employee Name:</span>
<form:input path="firstName" />
<input type="submit" name="Search" value="Search" />
</form:form>
</div>
</c:if>
<c:if test="${requestScope.C}">
<div id="div1">
<form:form commandName="employeeForm"
action="/EmployeeWebAppUI/EmployeeGetController/findByDepatmentId"
method="post">
<span>Department ID:</span>
<form:input path="departmentId" />
<input type="submit" name="Search" value="Search" />
</form:form>
</div>
</c:if>
</table>
<p> </p>
</td>
<td width="888" rowspan="2">
<tr>
<td height="693" bgcolor="#CC6600"></td>
</tr>
</table>
</body>
</html>
Instead of getting complete page get only data from Server and then render data on page using JavaScript.
This is typically possible if you post page asynchronously ( or using Ajax). The way you do is :
Call action by passing input parameters to the server using Ajax.
Get response in JSON form from server
Parse JSON data and then populate page using DOM manipulation.
You can use any JS library like jQuery to simplify your Ajax call as well as doing DOM manipulation.
Assuming you are using jquery
on click of tab or lable do AJAX request .
It will call your servlet and write the data into ajax response there.
on client side onsuccess do the required stuff .
function changeCOntent(type){
$.ajax({
type: 'POST',
url: 'servletpath?type=passtype',
success:function(data){
$('#contentDiv').innerHTML = data;
}
});
}

html field alignment

Good afternoon,
I am new to html. I have added html form fields into my application. The textfields are not aligned and they look really untidy. This is because i have field names like 'first tag' and 'second tag' which have a text field beside it. The text field for second tag appears more towards the left compared to the first. Is there a way i can align them without using a table? if i use a table, may i know how should i do it? i am sorry i cant upload any photos since i am a new user.
below is my html code.
Thank you for any help!
Cheers,
ZhengHong
<div class="rightsettings">
<form name="addsubject" action="html_form_action.asp" method="get">
<br>Subject: <input type="text" name="user" /></br>
<br>Number of tags<select name="addnoofsubject" id = "addnoofsubject" onchange="checktags()">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select></br>
<div id="addfirsttag">
<br>First Tag: <input type="text" name="tag1"/></br>
<div id = "addsecondtag" style="visibility:hidden">
<br>Second Tag: <input type="text" name="tag2"/></br>
</div>
<div id = "addthirdtag" style="visibility:hidden">
<br>Third Tag: <input type="text" name="tag3"/></br>
</div>
<div id = "addfourthtag" style="visibility:hidden">
<br>Fourth Tag: <input type="text" name="tag4"/></br>
</div>
<div id = "addfifthtag" style="visibility:hidden">
<br>Fifth Tag: <input type="text" name="tag5"/></br>
</div>
<br><input type="submit" value="Submit" /></br>
</form>
</div>
I recommend you to insert your forms into tables.
<div class="rightsettings">
<form name="addsubject" action="html_form_action.asp" method="get">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td>Subject:</td><td><input type="text" name="user" /></td></tr>
<tr><td>Number of tags::</td><td><select name="addnoofsubject" id = "addnoofsubject" onchange="checktags()">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
</select></td></tr>
<tr><td>First Tag:</td><td><div id="addfirsttag"><input type="text" name="tag1"/></div></td></tr>
<!-- all your tags like the one above -->
<tr><td colspan="2" align="center"><input type="submit" value="Submit" /></td></tr>
</table>
</form>
</div>
try this one
<table>
<tr style="visibility:hidden"><td>First tag :><td><input type="text" name="tag1"/></td></tr>
<tr style="visibility:hidden"><td>Second tag :><td><input type="text" name="tag2"/></td></tr>
<tr style="visibility:hidden"><td>Third tag :><td><input type="text" name="tag3"/> </td></tr>
<tr><td colspan="2" align="center"><input type="submit"></td></tr>
</table>
with a table
<table>
<tr><td>First Tag</td><td><input ... /></td></tr>
<tr><td>Second Tage</td><td><input ... /></td></tr>
...
</table>
with css
css part :
label
{
display: block;
width: 150px;
float: left;
}
html part :
<label for="tag1">First Tag:</label><input ... /><br />
<label for="tag2">Second Tag:</label><input ... /><br />