CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 updateable grid with radiolist 1 to 5

Print topic Send  topic

Author Message
ocougar
Posted: 07/02/2002, 5:48 AM

Hi, folks.

I am working on a questionaire with the option to rate a question
from 1 to 5. For example:
I enjoy working as a member of a team; radiolist 1=absolutely not to 5=yessir;

Now this:
First:I want to display the whole thing in an updateable grid ( already checked on the article in this forum ) an let the user alter the input via an
horizontal radio list.

Second:I want the user to be able to select how many questions he/she wants to see at once.
Please check on

http://motivatoren.dic.at/test.php

to get an idea.
Any suggestions?
Regards,
Walter
Chris K.
Posted: 07/02/2002, 10:19 AM

Very interesting example.

To setup number of records displayed per page modify PageSize grid's property according to user selection (you can keep this in session for instance and assign in grid's BeforeShow event).

Any problems with submitable grid itself?
ocougar
Posted: 07/02/2002, 11:55 PM

Well, I know how to set the numbers of records shown in a grid.
I want the user to select it. ;-)

The problem with
http://motivatoren.dic.at/test.php
is, that
I have a question with 5 possible answers -> radio list.
Is the input type in the header of the form text or radio ?

As you can see, it is not working properly because the values are not
passed on right.

Any suggestions ?

Regards,
Walter
Chris K.
Posted: 07/03/2002, 12:05 AM

I'm sorry, could you be more specific? What do you mean by:

"Is the input type in the header of the form text or radio ?"

To make it work I would put hidden field with userid and make answer array indexed by questionid (name the radiobutton answer[{questionid}]). You could then process submitted data:

foreach ($HTTP_GET_VARS["answer"] as $questionid => $answer)
$connection->query("INSERT INTO question_answers VALUES (NULL, $questionid, $userid, $answer, curdate())");

or detect editing existing user answer and UPDATE.
ocougar
Posted: 07/03/2002, 12:29 AM

Wooouh, Chris,
that is what I call fast. ;-D

Now-
in the open event of the page header:
$max = dLookUp("client_input", "max(id)", "1=1");
$min = dLookUp("client_input", "min(id)", "1=1");

for ($i=$min; $i<= $max; $i++)
{
//echo $i." is ".get_param("$i")."<br>";
$answer = get_param("$i");
if ($answer != "")
{
$answer = str_replace(",", ".", $answer);
$sSQLu = "UPDATE client_input SET answer=" . $answer . " WHERE id=".$i;
$db->query($sSQLu);
}
}

In the before show event of the form:
$fldanswer = "<input type=text name=" . $fldid . " value=". $fldanswer . " size=1>";

and last but not least in the header/footer section of the form itself:

form name=test method=get and so on.

Is that of any help to you?
Thanks for your assistance in advance.
Walter
Nicole
Posted: 07/05/2002, 1:35 AM

Hello,
your approach isn't clear for me enough, but I suppose you want to let users to select response to each question, then move to the next one without submitting the form and then submit it once at the end of the quiz? Am I correct?
In this case you should pass the number of question and selected answer to the next page, e.g.
when go to second page
http://motivatoren.dic.at/test.php?client_id=&q1=2&Form...age=2#take_test

when go to third page
http://motivatoren.dic.at/test.php?client_id=&q1=2&q2=4...age=2#take_test
etc.

When after form is submitted you'll be able to use the code for editable grid (posted in your previous response).
ocougar
Posted: 07/05/2002, 8:47 AM

Dear Nicole,

no, the answers should be stored in the table as soon as the user moves forwards
or backwards.
I check out the quiz example right now.
By the way: I have two forms in an other project
( http://www.onlinegalerie.at/db/index.php )
and I would like to concat these two when artist grid is clicked in order to see
next artist I want to move the detail form to the works of next artist.
Master detail, isn't it ?
;-)
Regards,Walter

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.