• 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

return back in js

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have an loop in javascript function.
when else condtion is satisfied inside loop then it go to another jsp page. by this
document.form2.submit();
where form2 is perfectly defined in same jsp page
now from another jsp page i perform what i want

problem is:---how can we return back from that page to previous page javascript function then loop continues.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UM...I do not think anyone has anyclue what you are talking about.

You have some loop. You want to loop until a condition is met, submit a form to another page, and than restart the loop there you left off?

What is this loop? What is this condition, why are you looping? etc.

Eric
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for(i=0;i<4;i++)
{
var con=confirm(" ");
if(con==true)
{}
else
{
document.form1.submit();
}
}


suppose at i=1 it goes to else condtion ,then after performing another page function it will return back to this loop and now i=2
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After the form submit the current page (and any JavaScript that it was executing) is gone and replaced by the second page; there's no way to resume it. If -some time later- the page is redisplayed somehow, then the JavaScript execution will start from the beginning.

If you just want to submit the form *without* replacing the page by some other page -and continue the JavaScript execution right after the form submission-, you can submit the form through an AJAX call using a library like Prototype or jQuery.
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
achha
if i completed for loop then inside that js function i submit the form
then the page return back to again this page then its data (textfield value) which i entered run time is not shown
means
tfields are empty
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you submitting the form through AJAX? Only then would the page context not get destroyed. If the form is submitted in the "normal" way, and you want the fields populated with the values that were entered, then the server-side code needs to generate the HTML page accordingly.
 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf Dittmer
thankyou for your reply
i submitted form in normal way,but i want that page context not destroyed.
can you tell me how can i submit it through AJAX.
please write the code.
I don't have idea about AJAX
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now would be a great time to learn. There are lots of Ajax resources available.
reply
    Bookmark Topic Watch Topic
  • New Topic