• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

retaining value in java script

 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose i have 3 text fields. The user enters the values for all the fields and clicks submits. Now if third text field gives some error....I want to retain the values of first 2 text boxes and set focus on 3rd text box where the error occured.How can i do this?
 
Sheriff
Posts: 67502
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using any server-side templating technology such as JSP or PHP? If so, simply use that to set the value attributes of the fields to their submitted values.
 
Maan Suraj
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no i am not using any servlet technology. i just have an html page.....

can you please explain this through a small example
thanks in advance
 
Bear Bibeault
Sheriff
Posts: 67502
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's little in native HTML and JavaScript to help you with this. The easiest way to do this is on the server side. How are you processing your form data on the server -- you have to be using something.

You might also look into something like Google Gears, but if you can already do it on the server, that'd be easiest.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u could do a javascript validate routine linked to onSubmit, Before form gets submitted. and bring focus to the offending element
 
Bear Bibeault
Sheriff
Posts: 67502
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sapika Am:
u could do a javascript validate routine linked to onSubmit, Before form gets submitted. and bring focus to the offending element


What does this have to do with the question?

Moreover, please use real words when posting to the forums. Abbreviations such as "u" in place of "you" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic