i want to build a website like the following one http://freeonlinesurveys.com/
so is there any same readymade script or code to use it
or some things that i can develop it to be like that or i should start from zero ??
Best Regards
Printable View
i want to build a website like the following one http://freeonlinesurveys.com/
so is there any same readymade script or code to use it
or some things that i can develop it to be like that or i should start from zero ??
Best Regards
This might be a place to start.
What's that link supposed to be? :confused:
If you want to look for a readymade script, look at www.411asp.net who have categories/listings of scripts.
If you want to do this yourself, you'll need to learn a bit about databases, ADO.NET and of course ASP.NET.
Dear mendhak the link is an online survey site , according to your answer i should start buliding one by myself ..
i need an editor like in the picture from wher i can get to include it ?
I'm a big fan of tinyMCE but there are lots of javascript Text editors out there.
Regarding the database any body could give some hints especialy for the questionner table ..
also when the end user hit the lunch buton to lunch his survey , i need to lucnh for him a link that he can distribute by email how i can do that ?
thanks very much for your help
When you've saved the survey to the database, you will have a ROW ID. That ROW ID can serve as the ID of the survey. So you might have a surveypage.aspx and you can pass it
www.example.com/surveypage.aspx?surveyid=9219
The user can distribute that via email.
ok , but that link how i can let it appear to the end user for example let's say that i have the follwoing :
click here to generate an email link now when the user click on the prev link i need to generate to him ( appear to him ) thje link which will distributed ? how i can do that ?
After creating the survey, you will have an ID from your database. If you don't, you should modify your stored procedure to return the ID of the newly created survey. You can store that ID, say, in a session variable. Pass that along to the page that generates the emails and use it in the body of the email.
thanks for your help ..
Problem solved? Add resolved. If not, ask more questions :)
- should i put Question and answer in one table or sepreated ?
- the ID if i put it Auto Increment , it will make a problem later on ?
In the database i'll expalin my Question in the following senario
let's say that three people make thire survey , gnerated the link and they send it by email ,
- now should i make databese for every user alone so can everyone has his result , or how i can connect the user who made survey with his own result. so when he access his control area he can see the result for his own survey ..
Senario 2:
while user making his survey at first it show for him a dropdown list he will choose from it the type of survey that he want let say for example he choose yes/no
- now i need after he made his choice to apper to him the editor to put his Questions , how i can make the editor hide until he choose the type of survey from the dropdown list ?
- after that he'll go to next page to put the answers for the questions , here my question is after he choose the survey type and puting the his Q A how i can generate page that has Q and the radio button ( yes/No) under each question ?
Separate the questions and answers. Each set of entries by an end user will correspond to questions which means that you'll have to have a foreign key reference.
No, the autoincrement won't cause a problem.
Obviously, don't make a new database for each user. It'll just be separate rows in the same table, differentiated by the User ID.
To hide a control you simply set its Visible property to false (either through codebehind or javascript). When the user selects an option you can make it visible using codebehind or javascript.
To generate a series of questions, use a repeater. For each question in the dataset, the repeater will render out one row, which is where you'd need to define the look and feel of the question in an ItemTemplate.
I strongly suggest that you get the database design nailed down first, else you'll face problems later.
how i can separate rows in the same table ?
i'll design the database and come back post it here so you can give me your opinion
Yeah, that'd be a better idea - show us the database design and then your question of how or whether you should separate the 'rows' or not can be answered.
kindly find the link below for the database
http://rapidshare.com/files/18625244...eydatabase.zip
waiting for your reply..
Regards
Er... I was hoping for a database diagram, not the entire database :sick:
I don't have SQL Server on this machine. Didn't you make a drawing with some boxes at any point? You know... with column names and the likes... :D
well , i already made flow chart for the database by visio i'll put it today
also i'll put a photo for the database from sql server
That would be helpful and kind of you :)
(And of course the right way to start)
kindly find below the link for database
rapidshare.com/files/187872236/DataBase_Photo.zip.html
Regards
Right, that's good. Still some changes you need to make though.
A survey can consist of multiple questions. Therefore, you should not have a 'question' row in the survey table. Make a new table just for questions. Each question should obviously have a QuestionId (auto increment) and be associated with a survey ID.
I assume 'type' means that it is either a Y/N or T/F or Written answer type question. Yes? I believe the type should also be stored against the question row rather than the survey itself. Think about it - would a survey consist of a series of questions of all types or just one type?
All surveys I see have multiple types, so this 'type' field should really be against the question itself.
Now that you have the questions in place, you need the potential answers against each question.
I'm assuming that's what the bottom 3 tables are, but of course, again, they should be against each question.
Finally, each user will select a survey and select answers in that survey. You will need another table that holds the userid against questionids along with answerIDs selected.
You also had a question about foreign keys incrementing? Not sure what you meant, but only the primary key in those tables should be made to increment. The foreign keys are simply constraints that say "If ID 92 exists in the parent table, then and only then will I allow the value 92 in this field in this child table."
kindly could you plz give me a simple design for the changes
Type meant that it is either a Y/N or T/F or Written answer , its the type of answer for the question , user will choose the type for each question
kindly find the attached for the changes..
did you mean i should make a table lets say it's name Result and consist from following rows ?Quote:
Finally, each user will select a survey and select answers in that survey. You will need another table that holds the userid against questionids along with answerIDs selected.
- ResultID
- UserID
- QuestionID
- WID
- TFID
- YNID
i really appreciate your help and i dont know how i should thank you for helping me ..
waiting for your reply
Regards
The Question table needs to know what type of a question it is linking to. Currently, the question table has no idea. This means that if you ask for QuestionID 29, your SQL query will have to look at at all three tables to find out where it is... that's inefficient. You will need to create a table with two columns - AnswerTypeId and AnswerTypeName. The values will be
1 - Written
2 - YesNo
3 - TrueFalse
Then, against each question, have an AnswerTypeId.
QuestionId = 29, Question = "Are you a pineapple?" AnswerTypeId = 2, SID = 8.
This way, when you see that AnswerTypeId = 2, you will look at the YesNo table, because you know that 2 is "YesNo".
OK, I need to add more comments - you don't have a way of specifying multiple choice questions.
I realize that I am not giving you a straight answer, I am only giving you pointers, this is because these skills that you will struggle with now will help you later when you work on a new project and help you realize how important database design is in any project. It's the foundation of your application and has to be done right.
I change it , kindly find the link below , i hope it's complete now and there is no mistake :blush: :
http://rapidshare.com/files/189415755/DB.zip.html
witing for your reply
thank you my friend
OK, unless I've overlooked something, that looks fine.
You should start coding against it now, if you face problems, you can always go back and change the schema, but the changes should be easy enough at this point.
ok , i'll start coding against it now and if i faceany problem that i can't solve it i'll come back asking for your help..
Thanks my friend
TC
No problem, let us know of your progress as you go along.
thanx , i knew it's take long time but finally i strat coding against it
when user creating his survey how i can spreate the row in the same table , cuz i dosent make sense to put every q i a row
It does make sense to have every question in a row. That's called the one to many relationship. One survey has many questions. One question has many answers.
You just need to make sure that a SurveyId has a relationship with several QuestionIds.
how i should do that (SurveyId has a relationship with several QuestionIds) ?
In the Questions table, have a column called SurveyId which has a foreign key reference to SurveyId in the survey table. Make sure it's not unique. This way, you have set up a one-to-many relationship between the Survey table and the Questions table.
ok , i'll do it and feed you back
Thanks, I am quite hungry.
sorry if i used a wrong Expression , i'll come back soon
i faced something , after the user put hi info to register and hit the save button everything is ok and the info stored in the database , but if he make a refresh for the page the info dublicated how i can prevent that ?
Hey,
You should use the Page.IsPostBack property:
http://msdn.microsoft.com/en-us/libr...spostback.aspx
To determine whether the page has actually been submitted or whether it has just been refreshed. Alternatively, once the user has clicked save, they are redirected to another page, just a thought.
Gary
I'll second that - it's better to redirect them to a 'thank you' page.
ok , is there ayway to disbale the refresh button form the browser at this page andalso F5 , am with you that the redirect page is better , but jus asking ... if i can do it or not ,,
hey,
I am not aware of a way of doing this, but it is definitely not something that you want to base your logic on. Rather, use the re-direct as suggested by myself and mend, or use the IsPostBack method to decide what should be done.
Gary
You can't disable F5 after the form has been submitted, but if you really want to stay on the same page, then you can (in the button click) process the details, redirect to the same page so that it's "fresh".
gep13 and mend thanks for your help , i was wondering if i can disable the F5 by any javascript in the code-behind page , but i'll take what you were suggested cuz i believe it's better as you said .. i'll come back soon
See you later.
still didnt get how i can wirte code to let user insert his survey's question and all questions will be under one SurveyID . i think i had confused abou how i can link the question table with the survey table & user table within the code :confused:
Not sure what you mean, you did have the design in place, are you facing difficulties?
my difficulties is in code when i insert the question in question's table how i can let surveyID in survey's table increment ?
In the Questions table, the SurveyID is a foreign key. You need to insert that value along with the rest of the data in the Questions table.
you mean i have to insert the surveyid programmaticaly and if yes how i can associate many QID to one SurveyID .. i want a code hint
You can do this based on your database design. Your database design, IIRC, allowed for one SurveyID to be linked to several QIDs. You need to make entries in that linked table. It's just an INSERT statement, try it out, show us where you get stuck.
thanx mend , i appreciate you help , i'll try with code and show it to you here , come back soon ...
kindly find below the insertb code :
and this is the stored procedure that i created :Code:Protected Sub btnsavesurvey_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsavesurvey.Click
cs.conn.Open()
Dim comm As New SqlCommand
comm.CommandType = CommandType.StoredProcedure
comm.CommandText = "SurveyIDTBLCONN"
Try
Select Case ddlquestionnaire.SelectedIndex
Case Is = 1
Dim cmd As New SqlCommand("insert into Questions(Question,SID,AnswerTypeID)values('" & txtq.Text & "','" & "@SurveyID" & "','" & 1 & "')", cs.conn)
cmd.ExecuteNonQuery()
MsgBox("تمت اضافة السؤال", MsgBoxStyle.Information, " احصائيات اون لاين")
Case Is = 2
Dim cmd As New SqlCommand("insert into Questions(Question,AnswerTypeID)values('" & txtq.Text & "','" & "@SurveyID" & "','" & 2 & "')", cs.conn)
cmd.ExecuteNonQuery()
MsgBox("تمت اضافة السؤال", MsgBoxStyle.Information, " احصائيات اون لاين")
Case Is = 3
Dim cmd As New SqlCommand("insert into Questions(Question,AnswerTypeID)values('" & txtq.Text & "','" & "@SurveyID" & "','" & 3 & "')", cs.conn)
cmd.ExecuteNonQuery()
MsgBox("تمت اضافة السؤال", MsgBoxStyle.Information, " احصائيات اون لاين")
Case Is = 4
Dim cmd As New SqlCommand("insert into Questions(Question,AnswerTypeID)values('" & txtq.Text & "','" & "@SurveyID" & "','" & 4 & "')", cs.conn)
cmd.ExecuteNonQuery()
MsgBox("تمت اضافة السؤال", MsgBoxStyle.Information, " احصائيات اون لاين")
End Select
Catch ex As Exception
MsgBox(ex.ToString)
End Try
cs.conn.Close()
cleartextboxz()
Response.Redirect("addsurvey.aspx")
End Sub
Code:ALTER PROCEDURE dbo.SurveyIDTBLCONN
AS
/* SET NOCOUNT ON */
Declare @SurveyID Int
Begin
Set @SurveyID = Scope_Identity()
Insert into Questions (SID) values (@SurveyID)
End
but still doesnt work , can't link the surveyID between the Question table and the survey table , could ypu plz help me ..
You have to link them in your database, not in code. What does your database look like right now?
kindly find the attached for the database.
also in the question table the SuervyID (SID) it's foreginkey but not autoincrement .. QuestionID is autoincrement and identity
in the suerveytable it's primarykey and identity autoincrement
Hey alqous,
Can I ask why you are using a case statement in the above code?
You are using the exact same query in each case with the exception of the survey ID. Why not use a parameter in the query string, and the value of that parameter will be ddlquestionnaire.SelectedIndex.
Related to that, you are concatentating the SQL string and building up the SQL string, this really should be avoided as it leaves you open to SQL Injection. To prevent this, you should always use parameterized queries. You can find an example of how to do this in this thread:
http://www.vbforums.com/showthread.php?t=469872
Hope that helps!!
Gary
Right, so what you do is to create a new survey, insert a new row into Survey. SID, which should be autoincrement, should return a value to you, the new primary key. Use that to insert into Questions along with the new questions.