• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing document.Check.lastBarcode.value to object in JSP javascript

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the if statement below that I want to use. When I use it I am told that lastBarcode is not an object.
If I replace the document.Check.lastBarcode.value with "2000", it works the way it is suppose to by the user getting the alert if they enter a value for barcode that is less than 2000.
How is it that I can use lastBarcode like I do below but as an object???
Please help!!!

if(document.Check.Barcode.value > document.Check.lastBarcode.value)
{
alert("Sorry, you must enter a barcode that is greater than " + document.Check.lastBarcode.value);
return false;
}
 
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would really need to see the form that contains barcode and lastbarcode to tell you why this doesnt work.
This is not really a servlet/JSP problem however!
S
 
Moined Mogul
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PLEASE HELP!!!
This is the code in my JSP that I am trying to get to work:
<script language="JavaScript1.2">
var a = parseInt(document.Check.Barcode.value);
var b = parseInt(document.Check.largestBarcode.value);
if(a > b)
{
alert("Sorry, you must enter a barcode that is greater than the one you just entered");
return false;
}
}
</script>
<tr>
<input type="hidden" name="largestBarcode" value="<%=(adminFunctions.lastBarcode(libraryBook))%>">
This is my bean method that gets the largest number form my database:
public synchronized int lastBarcode (Resource resource)
{
Vector vResourceList = new Vector();
String[] alResourceList = null;
int nArraySize = 0;
double fValue = 0;
Double tempDouble;
int nBarcode = 0;
try
{
m_Statement = m_Connection.createStatement();
m_Results= m_Statement.executeQuery (m_strBarcode);
while (m_Results.next())
{
vResourceList.addElement(new String(m_Results.getString("scancode")));
}
m_Statement.close();
}
catch (SQLException queryFails)
{
System.out.println("Exception retrieving resource list " + queryFails.getMessage());
}
alResourceList = new String[vResourceList.size()];
//Moving into array to use in JSP page
vResourceList.toArray(alResourceList);
//Getting the size of the array
nArraySize = (alResourceList.length);
tempDouble = Double.valueOf(alResourceList[nArraySize-1]) ;
fValue = tempDouble.doubleValue() ;
nBarcode = (int)fValue;
return (nBarcode);
}

 
We can walk to school together. And we can both read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic