Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

One of you brainiacs must know this one

 
Ranch Hand
Posts: 837
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Sum up : javascript does not find a hidden field's value but the value is there when you do a view source. Why?
If needed below is a more detailed description.
Heres the thing: I have a dropdown list that once clicked sends a user to the next screen, basically a lookup app. Basically the whole app is a report summary, there are 20 records per page and the user can use a forward and backward button to navigate through the pages. The dropdown list mentioned above allows the user to select a particular date that sends the app to a particular page for that date. Basically the date is passed to a javascript function that does a few things and then calls the document submit method. If the user goes back and decides to move one page ahead in the report he/she cannot, first in (without choosing a date) they can. I've put breakpoints in the function below and the variable Max_Number (which is set to a hidden field on the page) is "found" fine when first in and navigating forward but cannot be found once selecting a date and coming back to the same page and then try to move ahead 1 page.
The hidden field is not set to nothing (i.e. "")when submitting the form and when viewing the page's source (at the point where it cannot find the hidden field) the hidden field does have a value.
===== Forward button code ======
function Next_Recs(select)
{
if (document.DSA_FORM.sorttype.value != document.DSA_FORM.sortnum.value) {
document.DSA_FORM.sorttype.value = document.DSA_FORM.sortnum.value;
}
document.DSA_FORM.toggle_order.value = "";
switch (select)
{
case 2:
if (document.DSA_FORM.searchindex_loc.value != document.DSA_FORM.searchindex_locprev.value) {
document.DSA_FORM.searchindex_loc.value = document.DSA_FORM.searchindex_locprev.value;
}
Search_Integer = ((Number(document.DSA_FORM.searchindex_loc.value) - 1) * 20) + 1;
New_Search = Number(document.DSA_FORM.searchindex_loc.value) + 1;
Max_Number = Number(document.DSA_FORM.maxsearch_loc.value);
if ((document.DSA_FORM.searchindex_loc.value != "") && (Search_Integer < Max_Number || Max_Number == "")) {
document.DSA_FORM.searchindex_loc.value = New_Search;
document.DSA_FORM.searchtype.value = "LOCLOOKUP";
setTimeout('document.DSA_FORM.submit()', 500);
}
break;
..................... and so on
Thanks for any help.
(robert@wisl.com)
Rob
 
Lookout! Runaway whale! Hide behind this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic