Jump to content

Javascript Help needed


ieuan11

Recommended Posts

I'm doing a project for a client and the Financial Adviser's in the company needed to be able to visit a page and create a report on the fly:

 

Visit a webpage and be able to create a report based on a question form, This is an example of the report.

 

Client's Name: (Name is entered) This name will be replicated throughought the report as well as other information (this is just a quick exmaple).

 

First Question: "what are you serving the client?" Answers: "Pension", "Investment", "Mortgage", "Protection" Based on the answer a set of questions will appear below relevent to each answer.

 

For example if the Advisor choose Investment then the following question would be (as an example)

 

"What is the clients attitude toward risk managment?" Answers "Incliened to take high risks", "Inclined to take some risks", "Not very inclined to take risks" Based on this a paragraph related to the question would appear in the report which is being created below.

 

Then another question (also which appeared based on the answer Investment) would of appeared

 

This question would also have the same functionality as the one above,

 

Essentially what i am trying to achive is create a report which is created on the fly based on a form and a pool of questions (prefably not stored ina database to keep it simple) related to each answer, then copy the report from the website to a word document. As you can see i have tried to be as descriptive as possible with what i am trying to achive, I have little knowledge of Javascript/Jquery, I would be greatful if you could point me in the right direction by telling me what i need to do or any good tutorials. What would be amazing is if someone kind person could create a simple framework for this page in which i can develop further.

 

Thanks Ieuan.

 

Link to comment
Share on other sites

Do you want to do everything in Javascript or do you want to submit the data to the server and actually generate a Word document or PDF?Either way, you're not going to find a tutorial that teaches exactly what you're trying to do. You'll need to take it in pieces. For example, one thing would be to show or hide additional elements based on a selection from either a dropdown list or radio button or checkbox, however you want to do that. There should be plenty of things that teach how to do stuff like that. But break it down into individual pieces, just start at the top and go from there. Start with the client name field, then add the next question, etc. As you get to things that you don't know how to do then see if you can do some research to find out how to do those, or feel free to ask additional questions.

Link to comment
Share on other sites

Do you want to do everything in Javascript or do you want to submit the data to the server and actually generate a Word document or PDF?Either way, you're not going to find a tutorial that teaches exactly what you're trying to do. You'll need to take it in pieces. For example, one thing would be to show or hide additional elements based on a selection from either a dropdown list or radio button or checkbox, however you want to do that. There should be plenty of things that teach how to do stuff like that. But break it down into individual pieces, just start at the top and go from there. Start with the client name field, then add the next question, etc. As you get to things that you don't know how to do then see if you can do some research to find out how to do those, or feel free to ask additional questions.

Hi, Iv'e spent all day figuring out a way of doing this and came to the conclusion of hide/show, so far its going well, iv'e just come to an issue where when an option from a dropdown is clicked only one div apperas, however i need two divs to appear, please could you take a look and let me know:

 

JQuery:

<script type="text/javascript"> $(document).ready(function(){ $('.report-type-selection').hide();$('#dropDown').change(function(){$(this).find("option").each(function(){$('#' + this.value).hide();}); $('#' + this.value).show();}); });</script>

 

HTML:

<select id="dropDown"> <option>Choose</option> <option value="Investments">Investment Advice</option> <option value="Pensions">Protection Advice</option> <option value="Protection">Pension Advice</option> <option value="Mortgages">Mortgage Advice</option></select>

 

AND:

 

<div id="Investments" class="report-type-selection">Investments Div</div><div id="Pensions" class="report-type-selection">Pensions Div</div><div id="Protection" class="report-type-selection">Protection Div</div><div id="Mortgages" class="report-type-selection">Mortgages Div</div>

 

When i create two of the same divs which appear only one ever will. Please Help. Thanks.

Link to comment
Share on other sites

Iv'e now decided to change the way in which the report is going to be generated. At the end of the online form i want to the user to be able to submit the form they have filled in and from this a pdf is generated. Any ideas on how to go about achiving this?

 

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...