ive tried that unfortunately the onchange only seems to work when i click outside the input field, ive tried all the js tags cant seem to get any to work.
ive tried that unfortunately the onchange only seems to work when i click outside the input field, ive tried all the js tags cant seem to get any to work.
now if only i knew how to change the field depending if the field is null or not because i am using a barcode scanner and want to auto tab after every scan, i cannot seem to get this part working, any advice?
I was able to accomplish this using
<script>
function check()
{
var letters = document.inputData.swipeCard.value.length +1;
if (letters <= 6)
{document.inputData.swipeCard.focus()}
else
{document.inputData.workArea.focus()}
}
function check2()
{
var letters2 = document.inputData.workArea.value.length +1;
if (letters2 < 1)
{document.inputData.workArea.focus()}
else
{document.inputData.partNumber.focus()}
}
function check3()
{
var letters3 = document.inputData.partNumber.value.length +1;
if (letters3 <= 4)
{document.inputData.partNumber.focus()}
else
{document.inputData.quantity.focus()}
}
</script>
and
onKeyUp="check()"
onKeyUp="check2()" ..
Hello, does anyone know a simple way to focus on a different text field after the user enters data in the first text field? Thanks.
Hello, does anybody know a simple way to strip the leading zeros out of a string?
I have tried
userName.replaceFirst("^0+(?!$)", "");
but cant seem to make it work, any ideas?
Thanks.
correction, this work..
userName = userName.replace("0", "");
can somebody try and explain to me why this isn't possible or why its not allowed. whats the difference if i create a button that basically does the same thing as the default close button but i want it somewhere else, this seems restricting for what reasons.
Hello, i have been stuck on this for a while and is costing me alot of time. Can somebody please help me understand why in the eclipse ide under the project properties options, J2EE Module Dependencies, when i try and work with jar files placed under the file path \WebContent\WEB-INF\lib when i select jar files and apply them, every time i compile or save a jsp page the Dependencies are reset and i have to reset them every time a change is made, this is every time consuming and i don't understand why its happening. Is this a bug?
Thanks
so its not possible to close chrome and firefox with the click of a button? i dont want to use the top right exit button i want to hide the tool bar for an app and have a exit button that users can click on a scanner and close the page without seeing the toolbar for web restricted access on the portable device.
This works in IE, FF, and Chrome...
<input type="button" value="Close Window" onclick="window.close()">
So this should work.....
<input type="button" style="float:left;width:100px;" value="Exit" onclick="window.close();"/></p>
but does not work for me. How did you make it work and close a chrome browser because no matter how many times i click that button it will not close chrome or Mozilla, but in ie it will close with one click.
i tried this aswell window.opener = self;
Hello, Thank you for your time.
I know it is possible to create an exit button using javascript but this only work in ie browsers and not what i want(i found a fix for it but isnt very good), can somebody please show me a better way of closing all types of browsers(Chrome, Mozilla, Internet Explorer).
Thanks
I wasnt able to figure it out, i am not very good with javascript, if you have some free time can you post some code as an example. This is what i tried anyway.
<option name="stop" id="stop"
<input id="eStop" name="eStop"
onchange="populateField(this.form)"
function populateField(frm){
test = frm.stop.value
alert('work' test)
frm.eStop.value = test
}
Thanks
give the input field an id. Set the combo box to call a function on change and pass the value to the function. Set that function to update the text field by id with the value received.
Can you figure it out from that or do you need all the code? I can't get that to you right now, maybe someone else can.
Im sure i can make it work, thanks for the advice, ill post back when i figure it out.
hello, i was wondering if anyone could help me find a way to allow a user to click items in a combo box and have its value populate an input field.
Thanks
use a <jsp:useBean to instantiate the bean on the jsp page
<jsp:useBean id="form" class="MyForm" scope="session"></jsp:useBean>
Eclipse all the way. Nothing compares
Answer:
JavaBean
public void setNotify(String n) {
notify=n;
}
public String getNotify() {
return notify;
}
HtmlForm
jsp:useBean id="formHandler" class="Concord.FormBean" scope="request"/>
<form action="process.jsp" method=post>
....
Yes <input type="radio" name="notify" value="Yes" <jsp:getProperty name="formHandler" property="notify" /> > <br>
No <input type="radio" name="notify" value="No" <jsp:getProperty name="formHandler" property="notify" /> >
Hello, does anyone have an example of radio buttons working with a java bean. It would help out allot. Thank you
How do i share variables between java beans, do i need to use jspGet property on the second jsp and re-set it, or can i skip that and do it another way. i need to get a value from my login.jsp and UserDataBean to my process.jsp and my MyFormBean so i can send the username to a database along with other info submitted from the process.jsp page,
i got it using
<jsp:getProperty property="strResult" name="user"/> ${ strUserName
but how can i save it in the other bean this set property isnt working.
<input type="HIDDEN" name="user" property="strResult" value=" "><jsp:setProperty property="strResult" name="form"/>}
It's hard to see what the overall system architecture might be. I guess there must be some specialised scanner s/w to initiate/receive the scan, interpret it and pass the resulting string to a browser interface. Maybe modern scaners come with some sort of ActiveX control to make this kind of theing possible. My scanner is way too old for anything like that.
the scanner is a new ikon model and takes care of the data input all by its self, pretty sweet stuff. The Java comes into play because i am coding this using a jsp page with a java bean to store the data and submit it to a database. i would use a drop down box for the selections but the drop down box searches by first letter and not by the full value.
Hello,
I was wondering if it is possible to restrict the values of a text input box to only accept set values such as "XBC1". I am trying to make a form for a scanner so you can scan bar codes and it will auto fill the form out and have default values set so incorrect values cant be submitted into the database and mess everything up.
Another question i have is, is it possible to populate the input box with a java array.
Thank you for your time.
what i have come up so far
servlet(the generated servlet)needs to be executed and put in the xml, not the default jsp page.
or 2 instances of the tomcat server one in eclipse one in tomcat and wrong classpaths.
Hello, thanks for your time.
Jsp + javaBean will not run in tomcat on local host http://localhost:8080/is/scannerForm/process.jsp, when i run it in eclipse though my local tomcat it actually does work and i can step through the jsp page as-well as the .java pages and i can see where they are saving variables into the bean and all is working with no errors. When it gets to the method in the bean to submit the accessed data to a oracle database(InsertmainElement()) the connection succeeds and it does submit though eclipse but when run by http://localhost:8080/is/scannerForm/process.jsp it will not submit to the data base. but will not generate any errors, checked tomcat logs not much there can be posted if it will help. Ive been stuck on this for a few days now.
:-/Anyone can help would be greatly appreciated.
main jsp page(form)
process.jsp
<!-- fandp manufacturing -->
<!-- author:bryn flewelling,date:2011.1.13 -->
<%@ page language="java" contentType="text/html"%>
<%@ page import="java.util.ArrayList" %>
<%@ page import="scannerForm.DataAccess" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="scannerForm.FormDataBean" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<jsp:useBean id="formbean" scope="application" class="scannerForm.FormDataBean">
<jsp:setProperty name="formbean" property="swipeCard"/>
<jsp:setProperty name="formbean" property="workArea"/>
<jsp:setProperty name="formbean" property="partNumber"/>
<jsp:setProperty name="formbean" property="quantity"/></jsp:useBean>
<head>
<title>Scanner Form</title>
<link rel="icon" type="image/ico" href="images/logo1.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(swipeCard,"A valid …
i have one, dont know if it is any better although as i am learning.
html dropdown box...
<p for="workArea">Work Area:
<select name="workArea" id="workArea" property="workArea" style="overflow:hidden;maxheight:10px;">
<%
DataAccess dataAccess = new DataAccess();
ArrayList workAreas = dataAccess.loadWorkAreas();;
Iterator it = workAreas.iterator();
String xx = null;
while(it.hasNext()) {
xx = (String) it.next(); %>
<option name="workArea" id="workArea" value="<%=xx%>"><%=xx%></option>
<% } %>
and in the java method...
public ArrayList loadWorkAreas() {
boolean bln_result = true;
conn_fandp = new conn();
bln_result = conn_fandp.getConnection(jdbc_connection);
if (bln_result == false) {
System.out.println("Connection to DCS FANDP schema failed.");
}
else {
System.out.println("Connection to DCS FANDP succeded.");
}
ArrayList workAreas = new ArrayList();
try {
String sql ="select prod_workarea from fandp.prod_workarea";
ResultSet rs = null;
Connection curr_conn = conn_fandp.current_connection;
rs = curr_conn.createStatement().executeQuery(sql);
while ( rs.next()) {
workAreas.add(rs.getString("prod_workarea"));
}
rs.close();
curr_conn.close();
}
catch(Exception e) {
System.out.println(e.getMessage());
}
// get an Iterator object for ArrayList using iterator() method.
Iterator itr = workAreas.iterator();
// use hasNext() and next() methods of Iterator to iterate through the elements.
System.out.println("Iterating through ArrayList elements...");
while(itr.hasNext()){
System.out.println("Iterations:" + itr.next());
}
//System.out.println("bryn " + itr.hasNext());
conn_fandp.current_connection = null;
conn_fandp = null;
//for testing purposes...
workAreas.add("Bryn21");
workAreas.add("bjdfd");
return workAreas;
}
now...can somebody please help me deploy in tomcat, i can get my jsp and bean working in eclipse under local tomcat but when i try and run it in a browser through local tomcat it does not work properly, no errors but it doesnt submit to do the db. i can add code if somebody can help.
Hello, and thank you for youre time,
I have a problem with my jsp application, when i try to get the values from the html form on the jsp page process.jsp, it sets the values of each element but then does not return them to the java page. It keeps checking the web page for more properties but when it reaches the bottom of the jsp page it terimates itsself and says source not found. Any help would be appriciated, Thanks
Here is the code for the process.jsp page
<%@ page import="java.util.ArrayList" %>
<%@ page import="scannerForm.DataAccess" %>
<%@ page import="java.util.Iterator" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<jsp:useBean id="formbean" class="scannerForm.FormDataBean"/>
<jsp:setProperty name="formbean" property="swipeCard"/>
<jsp:setProperty name="formbean" property="workArea"/>
<jsp:setProperty name="formbean" property="partNumber"/>
<jsp:setProperty name="formbean" property="quantity"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="icon" type="image/ico" href="images/logo1.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<title>Scanner Form</title>
</head>
<body BGCOLOR="#ffffcc" style="width:auto;height:auto;border-style:solid;border-color:#F00;">
<script type="text/javascript">
function validateForm()
{
if (document.frm.swipeCard.value ==""){
alert("A valid card number must be entered.");
document.frm.cardNumber.focus();
return false;
}
if (document.frm.partNumber.value ==""){
alert("A valid part number must be entered.");
document.frm.cardNumber.focus();
return false;
}
if (document.frm.quantity.value ==""){
alert("A quantity must be entered");
document.frm.quantity.focus();
return false;
}
}</script>
<% if (request.getParameter("swipeCard") == null && request.getParameter("workArea") == null && request.getParameter("partNumber") == null && request.getParameter("quantity") == null ){ %>
<form id="1" method="get" action="process.jsp" onsubmit="return validateForm()" style="width:auto;height:auto;border-style:solid;border-color:#F00;">
<h2>Scanner Form<br /><img id="image" src="images/logo.gif" href="images/logo.gif"/></h2>
<hr>
<p>Swipe Card Number:</p>
<p><input type="text" name="swipeCard" property="swipeCard"/></p>
<p for="workArea">Work Area:
<select name="workArea" id="workArea">
<%
DataAccess dataAccess = new …