Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7540 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I need a little help with the rest of this asp page using Mariano Peterson's ASP with FileMaker class. I have most of it translated but any extra help would be greatly appreciated.

Thanks.

Justin Grewe

Posted

Sorry about not posting the code, it was a busy day. I have this for my asp code so far, some of it is still in FX.php.

<%@Language="Jscript"%>

<!-- #INCLUDE FILE="FMP.asp" -->

<%

if(isset($_REQUEST['Submit'])==1)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

fm.param("RegistrationID", $_REQUEST['RegistrationID']);

result = fm.execute();

if(result.meta.foundCount == 0)

{

fm = new FMP("Questions1.fp5", "Main");

fm.action = "findall";

result = fm.execute();

foreach(result.data as $key => $value)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "new";

fm.param("RegistrationID", $_REQUEST['RegistrationID']);

fm.param("QuestionID", $value['QuestionID'][0]);

result = fm.execute();

}

}

}

if(isset($_REQUEST['form2'])==1)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.param('-recid', $_REQUEST['-recid']);

fm.action = "find";

result = fm.execute();

fm = new FMP('Evalrespond1.fp5', "AdminRespond");

fm.param('-recid', $_REQUEST['-recid']);

foreach(result.data as $key => $value)

{

if($value['Type'][0]==1)

{

fm.param('MultipleChoiceResponse', $_REQUEST['MultipleChoiceResponse']);

}

if($value['Type'][0]==0)

{

fm.param('ShortAnswerResponse', $_REQUEST['ShortAnswerResponse']);

}

}

fm.action = "edit";

result = fm.execute();

}

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

foreach(result.data as $key => $value)

{

fm.param("RegistrationID", $value['RegistrationID'][0]);

fm.action = "find";

result = fm.execute();

%>

<html>

<title>Your Questions</title>

<body>

<h1><b><center>Your Questions</center></b></h1>

<%

foreach(result.data as $key => $value)

{

echo "<form action="http://localhost/FX/Evalrespond2.php" method="post">";

echo $value['QuestionID'][0];

echo ".";

echo "<br>";

echo $value['QuestionsQuestionID::Question'][0];

echo "<br>";

echo "Your response:";

echo "<br>";

if($value['Type'][0]==0)

{

echo "<textarea rows="10%" cols="100%" name="ShortAnswerResponse"> ";

echo $value['ShortAnswerResponse'][0];

echo "</textarea>";

echo "<br>";

}

if($value['Type'][0]==1)

{

echo "1";

if($value['MultipleChoiceResponse'][0]==1)

{

echo "<input type="radio" name="MultipleChoiceResponse" value="1" CHECKED />";

}

else

{

echo "<input type="radio" name="MultipleChoiceResponse" value="1"/>";

}

echo "2";

if($value['MultipleChoiceResponse'][0]==2)

{

echo "<input type="radio" name="MultipleChoiceResponse" value="2" CHECKED />";

}

else

{

echo "<input type="radio" name="MultipleChoiceResponse" value="2"/>";

}

echo "3";

if($value['MultipleChoiceResponse'][0]==3)

{

echo "<input type="radio" name="MultipleChoiceResponse" value="3" CHECKED />";

}

else

{

echo "<input type="radio" name="MultipleChoiceResponse" value="3"/>";

}

echo "4";

if($value['MultipleChoiceResponse'][0]==4)

{

echo "<input type="radio" name="MultipleChoiceResponse" value="4" CHECKED />";

}

else

{

echo "<input type="radio" name="MultipleChoiceResponse" value="4"/>";

}

echo "5";

if($value['MultipleChoiceResponse'][0]==5)

{

echo "<input type="radio" name="MultipleChoiceResponse" value="5" CHECKED />";

}

else

{

echo "<input type="radio" name="MultipleChoiceResponse" value="5"/>";

}

}

echo "<input type="hidden" name="-recid" value=" ";

echo $value['CurrentRecID'][0];

echo ""/>";

echo "<input type="hidden" name="RegistrationID" value=" ";

echo $value['RegistrationID'][0];

echo ""/>";

echo "<br>";

echo "<br>";

echo "<input type="submit" name="form2" value="Save Answer"/>";

echo "</form>";

}

echo "<br>";

echo "Submit Evaluation:";

echo "<br>";

echo "<form action="http://localhost/FX/thankyou.htm">";

echo "<input type="submit" value="submit"/>";

?>

Thanks again.

Justin Grewe

Posted

This ought to do it:


<%@Language="Jscript"%>

<!-- #INCLUDE FILE="FMP.asp" -->

<%

 

// Check if Submit is one of the request arguments

if (Request("Submit") + 0)

{

	// Find all responses for this registration ID

	fm = new FMP("Evalrespond1.fp5", "AdminRespond");

	fm.action = "find";

	fm.param("RegistrationID", Request("RegistrationID");

	result = fm.execute();

 

	// If no responses exist, create one response for each question

	if (result.meta.foundCount == 0)

	{

		fm = new FMP("Questions1.fp5", "Main");

		fm.action = "findall";

		result = fm.execute();

		for (i in result.row)

		{

			fm = new FMP("Evalrespond1.fp5", "AdminRespond");

			fm.action = "new";

			fm.param("RegistrationID", Request("RegistrationID");

			fm.param("QuestionID", result.row[i].data.QuestionID;

			result = fm.execute();

		}

	}

}

 

// Check if form2 is one of the request arguments

if (Request("form2") + 0)

{

	// Find one specific response by recID

	fm = new FMP("Evalrespond1.fp5", "AdminRespond");

	fm.param("-recid", Request("-recid");

	fm.action = "find";

	result = fm.execute();

 	

	// Update the response

	// (Since you already know the recID, why not just skip 

	// straight to the update, and remove the find from the 

	// previous 4 lines?)

	fm = new FMP("Evalrespond1.fp5", "AdminRespond");

	fm.param("-recid", Request("-recid");

	if (result.row[0].data.Type == 1)

		fm.param("MultipleChoiceResponse", Request("MultipleChoiceResponse");

	if (result.row[0].data.Type == 0)

		fm.param("ShortAnswerResponse", Request("ShortAnswerResponse");

	fm.action = "edit";

	result = fm.execute();

}

 

// Find all responses for this registration ID

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.param("RegistrationID", result.row[0].data.RegistrationID;

fm.action = "find";

result = fm.execute();

 

%>

 

<html>

<title>Your Questions</title>

<body>

<h1><b><center>Your Questions</center></b></h1>

 

<% 

// For each response...

for (i in result.row)

{

	row = result.row[i].data;	// make an alias to the current row's data

 	

	Response.write("<form action="http://localhost/FX/Evalrespond2.php" method="post">");

	Response.write(row.QuestionID + ".<br>");

	Response.write(row.QuestionsQuestionID::Question);

	Response.write("<br>Your response:<br>");

 

	if (result.row[i].data.Type == 0)	// this response is a text summary

	{

		Response.write("<textarea rows="10%" cols="100%" name="ShortAnswerResponse"> "); 

		Response.write(row.ShortAnswerResponse);

		Response.write("</textarea><br>");

	}

 

	if (row.Type == 1)					// this reponse is a radio option

	{

		Response.write("1 <input type="radio" name="MultipleChoiceResponse" value="1"");

		if (row.MultipleChoiceResponse == 1)

			Response.write(" CHECKED");

		Response.write("/>");

 

		Response.write("2 <input type="radio" name="MultipleChoiceResponse" value="2"");

		if (row.MultipleChoiceResponse == 2)

			Response.write(" CHECKED");

		Response.write("/>");

 

		Response.write("3 <input type="radio" name="MultipleChoiceResponse" value="3"");

		if (row.MultipleChoiceResponse == 3)

			Response.write(" CHECKED");

		Response.write("/>");

 

		Response.write("4 <input type="radio" name="MultipleChoiceResponse" value="4"");

		if (row.MultipleChoiceResponse == 4)

			Response.write(" CHECKED");

		Response.write("/>");

 

		Response.write("5 <input type="radio" name="MultipleChoiceResponse" value="5"");

		if (row.MultipleChoiceResponse == 5)

			Response.write(" CHECKED";

		Response.write("/>");

	}

 

	// Add the option to save changes on a row-by-row basis

	Response.write("<input type="hidden" name="-recid" value="" + row.CurrentRecID + ""/>");

	Response.write("<input type="hidden" name="RegistrationID" value="" + row.RegistrationID + ""/>");

	Response.write("<br>");

	Response.write("<br>");

	Response.write("<input type="submit" name="form2" value="Save Answer"/>");

	Response.write("</form>");

}

 

// Exit to a thank you page

Response.write("<br>");

Response.write("Submit Evaluation:");

Response.write("<br>");

Response.write("<form action="http://localhost/FX/thankyou.htm">");

Response.write("<input type="submit" value="submit"/>");

%> 

Posted

Mariano,

Thanks a lot. This just proves that anything is possible with FileMaker. I have a meeting with the Information Services director and the web team of Berea College on Tuesday to discuss the possibility of using FileMaker alone as our database for all of our web/database needs. Right now they are using SQL Server but this costs a lot every year with the high licensing prices of Microsoft. Our college was founded using FileMaker as its primary d-base, but when the web team was formed they suggested the use of MSQL because of how limited FileMaker was and its inability to use ASP and PHP. Now with this I should be able to change some policies at the college. Thanks again.

Justin Grewe

Posted

Mariano,

I have tried the code and I get the following asp error:

Error Type:

Microsoft JScript runtime (0x800A138F)

Object expected

/FX/Evalrespond2.asp, line 4

Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)

Page:

GET /FX/Evalrespond2.asp

Is there a problem with the FMP.asp object class or something? Maybe its the REQUEST?

Thanks,

Justin Grewe

Posted

BTW, I made a little mistake in my translation (although I doubt this is the source of the error you described):

The line that references

[color:"white"]___row.QuestionsQuestionID::Question

should be changed to instead reference

[color:"white"]___row["QuestionsQuestionID::Question"]

This is just an alternate syntax that is required when the field names include special characters (in this case the field name includes the relationship name and the :: characters).

Posted

Hi Justin!

Before u go on your meeting....if I may....please dont get offended but:

"This just proves that anything is possible with FileMaker"

- should read:

"anything is possible over the web"... it is the actual PHP/ASP that Betters FM not the other way arround.

"...discuss the possibility of using FileMaker alone as our database for all of our web/database needs."

- again, depends on your "web needs" and what they are!

I would NOT suggest this as you will find MySQL to be free and MUCH more robust for the web use vs. FM.

FM is great for what it is.....a desktop,medium level standalone DB.....it was never "built for web-based applications and processing" it was only developed and geared in that direction by talented people like Mariano and companies making middlewares like Lasso....while MySQL's core is build on "web premisis".

Whatever you decide I am sure you will have your own reasons for it but to really "exploit" web I would suggest looking into FM--dump into-->MySQL+PHP/ASP/JSP....being the cheepest way....I think your "web processing" and "web programming" will me much more easier (MySQL--ODBC--ASP or MySQL--PHP hooks) then re-designing FM DBs to fit web needs....it will take whole lot less coding of pages than using custom classes.....

again, not taking side here just giving some more ideas wink.gif!

Good Luck!

All the best!

Posted

Leb i Sol,

"anything is possible over the web"... it is the actual PHP/ASP that Betters FM not the other way arround."

This is exactly what I was saying. The web team had made claims that nothing would work over the web for FileMaker and that the only option would be MSQL.

Also, notice the MSQL. Berea College is using Microsoft servers, as well as databases. They are not using MySQL, instead using an expensive MSQL, microsoft's version.

The next point you brought up about that FileMaker was not made for web and SQL was made explicitly for the web is my BIGGEST point. Since SQL was made only for the web, there is no graphical interface that allows users to interact with the data directly. People that no little of programming cannot interact with it. Programmers need to develop seperate programs to interact with the data. With FileMaker however, FileMaker is already built. This works well for our college because everyone here has FileMaker on their computers. All the seperate departments like the financial department and the academic department use it to store their records and browse it. If their was a web capability we could use this instead of the multi-user ability through the network, allowing for of-campus access. Since we are using FileMaker so efficiently already, why do we need another database which is costing us tons of money every year if the original one that we had from the beggining would work fine?

You talk about exploiting FM and that the cheapest option is to dump into MySQL+PHP. I don't think its exploiting it at all. I have found it easy now to do anything that I need to do with FileMaker over the web and can not seem to find that many advantages over MSQL. People talk about how more advanced it is but can someone name many relavent diffrences?

I feel that tommorow at the meeting will go smoothly for us and that we will switch databases.

Justin Grewe

Posted

Mariano,

I used the page you translated in your post and got that error. I don't think its the syntax error that you pointed out either. Is it the REQUEST object that they are talking about?

Justin Grewe

Posted

I understand you used the page translated above. What am I wondering is, what did you name the translated page above? Is that "Evalrespond1.asp"? Or is that "StartQuestionnaire.asp"?

How are you calling this page? It sounds like for some reason the Request (not REQUEST) object is the culprit, as if for some reason it doesn't exist (which it should). You can try changing it to:

[color:"white"]___if (Request("Submit") + "" != "undefined")

, which is just another way of checking if the Request contains a submit.

You can also try calling this page from another page, and include a "Submit" param to see if the parser gets past that line. For example, you can open an IE window and type something like the following:

http://localhost/FX/Evalrespond1.asp?Submit=1&form2=1

Also, what is the default language on your ASP server (IIS)? Is it JScript? Or VBScript? I don't think it will make a difference in this case, but its worth checking.

I'll post some sample code in a while that should help us trouble shoot the problem.

Posted

Mariano,

I have fixed the page a little, its called Evalrespond2.asp. Now I am given this error when I go to the asp page:

Error Type:

Microsoft JScript runtime (0x800A01A8)

Object required

/FX/FMP.asp, line 180

Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)

Page:

POST 38 bytes to /FX/Evalrespond2.asp

POST Data:

RegistrationID=1math+313&Submit=Submit

But when I reload the page I get no error but just the submit evaluation button on the page.

I have looked at line 180 in FM.asp and am finding no object that should be there. What if anything could it be?

Thanks.

Justin Grewe

Posted

Hmm. Are you able to run the "example_06.asp" page successfully? Make sure that you can click through the pages successfully using the "next" and "previous" links. Whether or not this works will help us proceed in the right direction.

BTW, FMP.asp requires that MDAC (Microsoft Data Access Components) is installed on your machine. MDAC is usually installed with IIS, and I think if it were not installed that you would receive a different message. Still, it might be worth checking.

Let me know if the sample file runs properly on your machine.

Posted

Hi Justin!

Oh I understand you compleatly smile.gif

MSSQL really is "too big" for its own good....anything on the web does not really require MS peoducts...they simply fit together BUT the price of it too high. what's so great about it? : http://www.databasejournal.com/features/mssql/

it just has a LOT of tools that cut down on production time.

I was refering that you should keep an eye/option of MySQL if they really dont feel like FM is the way to go. MySQL is actually really nice as it stands as a server vs. "stand alone DB" making it more secure but its definition. next (5 I belive) version will alos support Stored Procedure which are much like scripts excpet they are more than welcomed over the web while FM that is not the case....SP will then cut on your code as you do not have to write FULL SQL (declare massive Relationshiops, creating fields on the fly) from your ASP pages on the but rather simple recordset filtering while the DB does the rest....the RS return speed is much faster than any Middleware/CDML/XML approach to FM. The down size in your MySQL ONLY based network is exaclty as you said...not as nice user GUI (there are MySQL tools which are as good as MS Access in comparison) but at the same time it is not like u can say that DBs made in FM by your users can "just go on the web"....as u know there is a quite a bit of work on DB before it is "web compatible"....so I guess it is a trade of.

Fix FM DBs and publish gaining the user "ease" of DB use

or "regulate import" into MySQL and gain on the web pefromance.

SQL can not be nor it is made for web...it would be like saying that AppleScirpt was inveted for the "web desing". :0

StructuredQueryLangage is just the way "most" DBs "talk"...it was the "enigine" inside of those MSSQL and MySQL that is optimised for web based transactions...Insert,Update,Drop Flush etc. perform "better" than they would in FM. + the issue of concurrent connections to your DB....I guess we would really have to talk about "what specific web needs" do you have.

Comparing MS Access and FM is fair game but FM with MSSQL is not....nor it is FM vs. MySQL on the web as I am afraid FM would not score that high.

Ultimatly if FM would only boost their ODBC FM would really score high on the web (ASP) and also with communation with other SQL based DBs.

So I would suggest (if u already have paied in "blood" for MSSQL) try to use it on the web as a "replica" of your FM Dbs that are used on campus.You could schedule MSQL---odbc/XML/CSV etc.--- pull from FM...this way u keep your nice FM while "monster MSSQL" can server the data over the web -hence you spend less time on "web programming".

Please don't get me wrong but the real question here is the issue of "how worth it the information to YOU"

eg. if I was storing medical records and pulling this infomation in Emergency Room I would NOT use FM as my DB (in any environment but especially over the web). Now, if you just want to show student records, grades etc. then FM would work...

Anyhow, if you would like to or can talk more about what your specific needs "over the web" are, maybe we chat some more...it is not about "converting you" but rather giving you the best advice wink.gif !

In my Very humble opinion The worst thing that can happen to a "DB/Syste," is deprechiation of performace and distruction of its desing....for data loss/corruption there is always some old backup laugh.gif

If you feel like you are on the good path then hey smile.gif it was a nice disscusion and wish you good luck with the project!

Let me know if you need any tools/help web/ASP design etc.....perhaps I can help...or better yet learn a few trick from your quests! laugh.gif

Take care!

Posted

Mariano,

I have run the Component Checker and it says I have MDAC 2.7 RTM installed. Also I have FileMaker 6.0 v.4. The example 6 works but the syntax that you mentioned before with relationships, row["QuestionsQuestionID::Question"] doesn't work.

I still am recieving the same error message on Evalrespond2.asp about the required object in FMP.asp.

Justin Grewe

Posted

Its very strange that the demo runs but not your own custom page. Could you please give me the following information:

1) Which page leads into the Evalrespond2.asp page?

2) Does Evalrespond2.asp load properly if you open it directly?

3) Does Evalrespond2.asp fail if you load it as the result of a form submission?

4) Please give me a list of events which lead to the error, i.e.:

-Open IE.

-Type "http://localhost/Evalrespond2.asp" in the address bar and click enter.

-The page loads OK.

-Select radio option 3, then click "Save Answer".

-Now I see error xyz.

=== or ===

-Open IE.

-Type "http://localhost/Evalrespond2.asp" in the address bar and click enter.

-The page loads OK.

-Select radio option 3, then click the "Submit" button at the bottom of the page.

-Now I see an error.

----------------

Also, another thing I just considered is that you are using the results of the FMP execute() method without checking for errors first. Take a look at the example files to see how to check for errors.

Posted

Yowzers. I found a few mistakes in the translation code I posted (not in the FMP class). This may have contributed to the problem. Here is a new version, which fixes a few errors where I forgot to put closing ")", and also adds some error trapping to your code.

Hope this helps, sorry for the frustration, and let me know how it works. I've also posted it as a .txt file to http://mariano.petersonpages.com/demo/asp/grewe.txt .


<%@Language="Jscript"%>

<!-- #INCLUDE FILE="FMP/FMPasp_v0-2/FMP.asp" -->

<!-- #INCLUDE FILE="FMP/FMPasp_v0-2/FMPError.asp" -->

<%

 

// This function is used to print out the error information

// Putting it in a function prevents us from having to write 

// it over and over again in the body, and makes the rest 

// of the page easier to read

function showError(oResult, intInstance) {

    Response.write("Error: " + oResult.meta.errorCode + " (instance " + intInstance + ")");

    Response.write("<br>n(" + FMPError[oResult.meta.errorCode] + ")");

    Response.flush();

    Response.end(); // halts execution of the script

}

 

// Check if Submit is one of the request arguments

if (Request("Submit") + 0)

{

    // Find all responses for this registration ID

    fm = new FMP("Evalrespond1.fp5", "AdminRespond");

    fm.action = "find";

    fm.param("RegistrationID", Request("RegistrationID"));

    result = fm.execute();

 

    // Added an error check here

    if (result.meta.errorCode != 0 && result.meta.errorCode != 401) {

        showError(oResult, 1);

    }

 

    // If no responses exist, create one response for each question

    if (result.meta.foundCount == 0)

    {

        fm = new FMP("Questions1.fp5", "Main");

        fm.action = "findall";

        result = fm.execute();

 

        // Added an error check here

        if (result.meta.errorCode) {

            showError(result, 2);

        }

 

        for (i in result.row)

        {

            fm = new FMP("Evalrespond1.fp5", "AdminRespond");

            fm.action = "new";

            fm.param("RegistrationID", Request("RegistrationID"));

            fm.param("QuestionID", result.row[i].data.QuestionID);

            result = fm.execute();

            

            // Added an error check here

            if (result.meta.errorCode) {

                showError(result, 3);

            }

        }

    }

}

 

// Check if form2 is one of the request arguments

if (Request("form2") + 0)

{

    // Find one specific response by recID

    fm = new FMP("Evalrespond1.fp5", "AdminRespond");

    fm.param("-recid", Request("-recid"));

    fm.action = "find";

    result = fm.execute();

    

    // Added an error check here

    if (result.meta.errorCode) {

        showError(result, 4);

    }

    

    // Update the response

    // (Since you already know the recID, why not just skip 

    // straight to the update, and remove the find from the 

    // previous 4 lines?)

    fm = new FMP("Evalrespond1.fp5", "AdminRespond");

    fm.param("-recid", Request("-recid"));

    if (result.row[0].data.Type == 1)

        fm.param("MultipleChoiceResponse", Request("MultipleChoiceResponse"));

    if (result.row[0].data.Type == 0)

        fm.param("ShortAnswerResponse", Request("ShortAnswerResponse"));

    fm.action = "edit";

    result = fm.execute();

    

    // Added an error check here

    if (result.meta.errorCode) {

        showError(result, 4);

    }

}

 

// Find all responses for this registration ID

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

//fm.param("RegistrationID", result.row[0].data.RegistrationID);

fm.param("RegistrationID", Request("RegistrationID"));

result = fm.execute();

 

// Added an error check here

if (result.meta.errorCode) {

    showError(result, 4);

}

 

%>

 

<html>

<title>Your Questions</title>

<body>

<h1><b><center>Your Questions</center></b></h1>

 

<% 

// For each response...

for (i in result.row)

{

    row = result.row[i].data;    // make an alias to the current row's data

    

    Response.write("<form action="http://localhost/FX/Evalrespond2.php" method="post">");

    Response.write(row.QuestionID + ".<br>");

    Response.write(row["QuestionsQuestionID::Question"]);

    Response.write("<br>Your response:<br>");

 

    if (result.row[i].data.Type == 0)    // this response is a text summary

    {

        Response.write("<textarea rows="10%" cols="100%" name="ShortAnswerResponse"> "); 

        Response.write(row.ShortAnswerResponse);

        Response.write("</textarea><br>");

    }

 

    if (row.Type == 1)                    // this reponse is a radio option

    {

        Response.write("1 <input type="radio" name="MultipleChoiceResponse" value="1"");

        if (row.MultipleChoiceResponse == 1)

            Response.write(" CHECKED");

        Response.write("/>");

 

        Response.write("2 <input type="radio" name="MultipleChoiceResponse" value="2"");

        if (row.MultipleChoiceResponse == 2)

            Response.write(" CHECKED");

        Response.write("/>");

 

        Response.write("3 <input type="radio" name="MultipleChoiceResponse" value="3"");

        if (row.MultipleChoiceResponse == 3)

            Response.write(" CHECKED");

        Response.write("/>");

 

        Response.write("4 <input type="radio" name="MultipleChoiceResponse" value="4"");

        if (row.MultipleChoiceResponse == 4)

            Response.write(" CHECKED");

        Response.write("/>");

 

        Response.write("5 <input type="radio" name="MultipleChoiceResponse" value="5"");

        if (row.MultipleChoiceResponse == 5)

            Response.write(" CHECKED");

        Response.write("/>");

    }

 

    // Add the option to save changes on a row-by-row basis

    Response.write("<input type="hidden" name="-recid" value="" + row.CurrentRecID + ""/>");

    Response.write("<input type="hidden" name="RegistrationID" value="" + row.RegistrationID + ""/>");

    Response.write("<br>");

    Response.write("<br>");

    Response.write("<input type="submit" name="form2" value="Save Answer"/>");

    Response.write("</form>");

}

 

// Exit to a thank you page

Response.write("<br>");

Response.write("Submit Evaluation:");

Response.write("<br>");

Response.write("<form action="http://localhost/FX/thankyou.htm">");

Response.write("<input type="submit" value="submit"/>");

%>

Posted

Mariano!

I got it, but it wasn't what you changed above. First off, I had findall as one of the actions and in FMP.asp, it is defined as findAll. I thought of this earlier but thought that your class was not case sensitive. So after changing that I ran into another problem of having an action of edit. I changed that to update and now its working fine. It's just a case of looking at the class more closely and using the right actions specified.

Sorry for the trouble.

Justin Grewe

Posted

Mariano,

I am still working on this page. I have got what I was trying to do a long time ago but now I have instead of showing all the questions in the questions database on the page, I have a field in filemaker and the two possibilities that it can have is either AllClasses, which means its a universal question(everyone has to answer it) and then a question based on the ClassID. I have another find in the questions database after I display the universal questions for the classID. Then I disply those results of questions on the same page after the universal one's. For some reason its not working. Right at the moment too I have the find for the RegistrationID, but this will change once I fix it in FileMaker. I will need to carry over the class id from the login page where they select their class. But this is another issue...

Anyway, here's my code. I've commented on the area where I think is the problem. At the moment, it displays the two sets of the same question with the same recid on the same page. Then it only allows one question that is not type classALL. So if I have two questions that have a class of 2Ast 302 then it will only show 1 on the page even though it finds both in filemaker.

<%@Language="Jscript"%>

<!-- #INCLUDE FILE="FMP.asp" -->

<!-- #INCLUDE FILE="FMPError.asp" -->

<%

// This function is used to print out the error information

// Putting it in a function prevents us from having to write

// it over and over again in the body, and makes the rest

// of the page easier to read

function showError(oResult, intInstance) {

Response.write("Error: " + oResult.meta.errorCode + " (instance " + intInstance + ")");

Response.write("<br>n(" + FMPError[oResult.meta.errorCode] + ")");

Response.flush();

Response.end(); // halts execution of the script

}

// Check if Submit is one of the request arguments

if (Request("SubmitEvalrespond") + 0)

{

// Find all responses for this registration ID

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

fm.param("RegistrationID", Request("RegistrationID"));

result = fm.execute();

// If no responses exist, create one response for each question

if (result.meta.foundCount == 0)

{

fm = new FMP("Questions1.fp5", "Main");

fm.action = "find";

fm.param("Class", "AllClasses");

result = fm.execute();

oktemp_varible = 1;

// Added an error check here

if (result.meta.errorCode) {

showError(result, 2);

}

for (i in result.row)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "insert";

fm.param("RegistrationID", Request("RegistrationID"));

fm.param("QuestionID", result.row.data.QuestionID);

fm.execute();

}

}

}

// Check if form2 is one of the request arguments

if (Request("form2") + 0)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.param("-recid", Request("-recid"));

StudentPINID = Request("StudentPINID");

fm.action = "find";

result = fm.execute();

// Update the response

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.param("-recid", Request("-recid"));

if (result.row[0].data.Type == 1)

{

fm.param("MultipleChoiceResponse", Request("MultipleChoiceResponse"));

}

if (result.row[0].data.Type == 0)

{

fm.param("ShortAnswerResponse", Request("ShortAnswerResponse"));

}

fm.action = "update";

result = fm.execute();

// Added an error check here

if (result.meta.errorCode) {

showError(result, 4);

}

}

// Find all responses for this registration ID

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

fm.param("RegistrationID", Request("RegistrationID"));

result = fm.execute();

// Added an error check here

if (result.meta.errorCode) {

showError(result, 4);

}

%>

<html>

<title>Your Questions</title>

<body>

<h1><b><center>Your Questions</center></b></h1>

<%

// For each response...

for (i in result.row)

{

row = result.row.data; // make an alias to the current row's data

Response.write("<form action="http://localhost/FX/Evalrespond3.asp#");

Response.write(row.QuestionID);

Response.write(" " method="post"name="");

Response.write(row.QuestionID);

Response.write("">");

Response.write(row.QuestionID + ".<br>");

Response.write(row["QuestionsQuestionID::Question"]);

Response.write("<br>Your response:<br>");

if (result.row.data.Type == 0) // this response is a text summary

{

Response.write("<textarea rows="10%" cols="100%" name="ShortAnswerResponse"> ");

Response.write(row.ShortAnswerResponse);

Response.write("</textarea><br>");

}

if (row.Type == 1) // this reponse is a radio option

{

Response.write("1 <input type="radio" name="MultipleChoiceResponse" value="1"");

if (row.MultipleChoiceResponse == 1)

Response.write(" CHECKED");

Response.write("/>");

Response.write("2 <input type="radio" name="MultipleChoiceResponse" value="2"");

if (row.MultipleChoiceResponse == 2)

Response.write(" CHECKED");

Response.write("/>");

Response.write("3 <input type="radio" name="MultipleChoiceResponse" value="3"");

if (row.MultipleChoiceResponse == 3)

Response.write(" CHECKED");

Response.write("/>");

Response.write("4 <input type="radio" name="MultipleChoiceResponse" value="4"");

if (row.MultipleChoiceResponse == 4)

Response.write(" CHECKED");

Response.write("/>");

Response.write("5 <input type="radio" name="MultipleChoiceResponse" value="5"");

if (row.MultipleChoiceResponse == 5)

Response.write(" CHECKED");

Response.write("/>");

}

// Add the option to save changes on a row-by-row basis

Response.write("<input type="hidden" name="-recid" value="" + row.CurrentRecID + ""/>");

Response.write("<input type="hidden" name="RegistrationID" value="" + row.RegistrationID + ""/>");

Response.write("<br>");

Response.write("<br>");

Response.write("<input type="hidden" name="StudentPINID" value=" ");

Response.write(Request("StudentPINID"));

Response.write(" " />");

Response.write("<input type="submit" name="form2" value="Save Answer"/>");

Response.write("</form>");

}

if(oktemp_varible = 1)

{

fm = new FMP("Questions1.fp5", "Main");

fm.action = "find";

fm.param("Class", Request("RegistrationID"));

result = fm.execute();

for(i in result.row)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "insert";

fm.param("RegistrationID", Request("RegistrationID"));

fm.param("QuestionID", result.row.data.QuestionID);

result = fm.execute();

}

}

if(Request("form3") + 0)

{

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

recordid = Request.QueryString("-recid");

fm.param('-recid', recordid);

result = fm.execute();

fm = new FMP('Evalrespond1.fp5', "AdminRespond");

fm.action = "edit";

recordid = Request.QueryString("-recid");

fm.param('-recid', recordid);

if(result.row[0].data.Type == 1)

{

muliplechoice = Request.QueryString("MultipleChoiceResponse");

fm.param("MultipleChoiceResponse", multiplechoice);

}

if(result.row[0].data.Type == 0)

{

shortanswer = Request.QueryString("ShortAnswerResponse");

fm.param("ShortAnswerResponse", shortanswer);

}

fm.execute();

}

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

fm.action = "find";

fm.size = "all";

fm.param("RegistrationID", Request("RegistrationID"));

result = fm.execute();

fm = new FMP("Evalrespond1.fp5", "AdminRespond");

for(i in result.row)

{

row = result.row.data;

Response.write("<form action="http://localhost/FX/Evalrespond2.php" method="post">");

Response.write(row.QuestionID + ".<br>");

Response.write(row["QuestionsQuestionID::Question"]);

Response.write("<br>Your response:<br>");

if (result.row.data.Type == 0)

{

Response.write("<textarea rows="10%" cols="100%" name="ShortAnswerResponse"> ");

Response.write(row.ShortAnswerResponse);

Response.write("</textarea><br>");

}

if (row.Type == 1)

{

Response.write("1 <input type="radio" name="MultipleChoiceResponse" value="1"");

if (row.MultipleChoiceResponse == 1)

Response.write(" CHECKED");

Response.write("/>");

Response.write("2 <input type="radio" name="MultipleChoiceResponse" value="2"");

if (row.MultipleChoiceResponse == 2)

Response.write(" CHECKED");

Response.write("/>");

Response.write("3 <input type="radio" name="MultipleChoiceResponse" value="3"");

if (row.MultipleChoiceResponse == 3)

Response.write(" CHECKED");

Response.write("/>");

Response.write("4 <input type="radio" name="MultipleChoiceResponse" value="4"");

if (row.MultipleChoiceResponse == 4)

Response.write(" CHECKED");

Response.write("/>");

Response.write("5 <input type="radio" name="MultipleChoiceResponse" value="5"");

if (row.MultipleChoiceResponse == 5)

Response.write(" CHECKED");

Response.write("/>");

}

Response.write("<input type="hidden" name="-recid" value="" + row.CurrentRecID + ""/>");

Response.write("<input type="hidden" name="RegistrationID" value="" + row.RegistrationID + ""/>");

Response.write("<br>");

Response.write("<br>");

Response.write("<input type="submit" name="form3" value="Save Answer"/>");

Response.write("</form>");

}

// Exit to a thank you page

Response.write("<br>");

Response.write("Submit Evaluation:");

Response.write("<br>");

Response.write("<form action="http://localhost/FX/thankyou.asp" method="post">");

Response.write("<input type="hidden" name="StudentPINID" value="");

Response.write(Request("StudentPINID"));

Response.write("" />");

Response.write("<input type="submit" value="submit"/>");

%>

This topic is 7540 days old. Please don't post here. Open a new topic instead.

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...

Important Information

By using this site, you agree to our Terms of Use.