Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I control/move the cursor/focus or whatever it's now called?

New Here ,
Sep 22, 2009 Sep 22, 2009

I have a page that is a questionnaire (form), and sometimes the answer to one question determines what the next question will be.

e.g. Ques 1.     Are you a veteran of the U. S Armed Forces.  If No, go to question 3; if Yes continue below                                   Yes.     No.

                         a.     What is your date of birth?     ___________

                         b.     What were your dates of service? from _________ thru ________.

                         c.     etc.

     Ques 2.     etc.

     Ques 3.     etc.

I need to be able to test the answer to one question and set the focus accordingly;  In some case, I also need to display data entered on previous pages; e.g. Ques 1., a., above, the DOB was entered in the previous page.  If the answer to question 1 is Yes, I would need to display the DOB, then set the focus at Ques 1., b if the answer to question 1 is Yes.  I'd also like to be able to set the focus in the first field of a form when the page is initially displayed.

How are these things done?????

Also, would it be best to make the entire page one <form>, or a separate <form> for each question???

TOPICS
Server side applications
534
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 22, 2009 Sep 22, 2009

creacontech wrote:

I need to be able to test the answer to one question and set the focus accordingly;  In some case, I also need to display data entered on previous pages; e.g. Ques 1., a., above, the DOB was entered in the previous page.  If the answer to question 1 is Yes, I would need to display the DOB, then set the focus at Ques 1., b if the answer to question 1 is Yes.  I'd also like to be able to set the focus in the first field of a form when the page is initially displayed.

How are these

...
Translate
LEGEND ,
Sep 22, 2009 Sep 22, 2009

creacontech wrote:

I need to be able to test the answer to one question and set the focus accordingly;  In some case, I also need to display data entered on previous pages; e.g. Ques 1., a., above, the DOB was entered in the previous page.  If the answer to question 1 is Yes, I would need to display the DOB, then set the focus at Ques 1., b if the answer to question 1 is Yes.  I'd also like to be able to set the focus in the first field of a form when the page is initially displayed.

How are these things done?????

With JavaScript. It needs to be scripted specifically for the various options you want.

Also, would it be best to make the entire page one <form>, or a separate <form> for each question???

One form to be submitted when all questions have been answered. However, lengthy forms might be better spread over several pages. However, that introduces the problem of storing all the values until the final form is ready to be submitted. You would typically do that with session variables server-side.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 24, 2009 Sep 24, 2009
LATEST

Thanks for the response.  I'm doing some research as we speak to learn about Javascript (using w3schools.com).  After I learn it, I'll probably be back to find out exactly where, in the page, that it goes (no wisecracks please - LOL).  If there're any more/better places to learn about it, please let me know what it/they are.  Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines