Jump to content

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

Recommended Posts

Posted

Hi All!

Thanks to this list and Garry, my online registration can now verify if a class is full. However, I have a new problem now.

If the class is full, the alert message pops up. If you click OK it returns you to the same screen. Great, wonderful, no problem there.

The problem:

If the class isn't full.....now, it doesn't want to go on to the next screen which is a "login" screen.

I get the error message: Unexpected error. Unable to process your request because the server encountered an unexpected condition. For more detail on error #4.......

We all know that error #4 is "Command is unknown" error.

Here's my code. Any suggestions?^_^

<SCRIPT LANGUAGE="JavaScript"><!--

function verify ()

{

if (document.verify.elements[5].value == "X")

{

alert ('This class is full! No registration allowed!');

}

else

{

document.verify.submit();

};

}

//--></script>

</HEAD>

<BODY CLASS="first">

<FORM NAME="verify" ACTION="FMPro" METHOD="post" onsubmit="verify(); return false;">

<INPUT TYPE="hidden" NAME="-DB" VALUE="CE_Events">

<INPUT TYPE="hidden" NAME="-lay" VALUE="Online">

<INPUT TYPE="hidden" NAME="-format" VALUE="login.htm">

<INPUT TYPE="hidden" NAME="-Token.3" VALUE="2003-M2">

<INPUT TYPE="hidden" NAME="-Token.4" VALUE="Horizon Demonstration">

<INPUT TYPE="hidden" NAME="-Token.7" VALUE="">

Thanks in advance! Donna

Posted

Here's my whole form:

<HTML>

<HEAD>

<LINK REL=stylesheet HREF="http://209.174.169.66:591/OnlineReg/online.css" TYPE="text/css">

<SCRIPT LANGUAGE="JavaScript"><!--

function verify ()

{

if (document.verify.elements[5].value == "X")

{

alert ('This class is full! No registration allowed!');

}

else

{

document.verify.submit();

};

}

//--></script>

</HEAD>

<BODY CLASS="first">

<FORM NAME="verify" ACTION="FMPro" METHOD="post" onsubmit="verify(); return false;">

<INPUT TYPE="hidden" NAME="-DB" VALUE="CE_Events">

<INPUT TYPE="hidden" NAME="-lay" VALUE="Online">

<INPUT TYPE="hidden" NAME="-format" VALUE="login.htm">

<INPUT TYPE="hidden" NAME="-Token.3" VALUE="2003-M2">

<INPUT TYPE="hidden" NAME="-Token.4" VALUE="Horizon Demonstration">

<INPUT TYPE="hidden" NAME="-Token.7" VALUE="">

<H2 ALIGN="center">Event Summary</H2>

<CENTER>

Name: <FONT COLOR="#008080">Horizon Demonstration</FONT><BR>

</CENTER>

<HR NOSHADE>

<TABLE WIDTH="70%" ALIGN="center" BORDER="3">

<TR>

<TD ALIGN="center" WIDTH="30%"><B>Registration Information</B>^_^</TD>

<TD ALIGN="center" WIDTH="40%"><B>Event Information</B>???</TD>

</TR>

<TR></TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Date: <FONT COLOR="#008080">4/24/2003</FONT></TD>

<TD ALIGN="left" WIDTH="40%">Event ID: <FONT COLOR="#008080">2003-M2</FONT></TD>

</TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Time: <FONT COLOR="#008080">9:00am - 4:00pm</FONT></TD>

<TD ALIGN="left" WIDTH="40%">Type: <FONT COLOR="#008080">Special</FONT></TD>

</TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Registration Limit: <FONT COLOR="#008080">100</FONT></TD>

<TD ALIGN="left" WIDTH="40%">Location: <FONT COLOR="#008080"></FONT></TD>

</TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Current Registered Participants: <FONT COLOR="#008080">58</FONT></TD>

<TD ALIGN="left" WIDTH="40%">Fee: <FONT COLOR="#008080"></FONT></TD>

</TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Contact Hours: <FONT COLOR="#008080">6</FONT></TD>

<TD ALIGN="left" WIDTH="40%">Topic: <FONT COLOR="#008080">General</FONT></TD>

</TR>

<TR>

<TD ALIGN="left" WIDTH="30%">Credits: <FONT COLOR="#008080"> &nbsp; </FONT></TD>

<TD ALIGN="left" WIDTH="40%">Category: <FONT COLOR="#008080">Planning and Instruction</FONT></TD>

</TR>

<TD ALIGN="left" WIDTH="30%">Full: <FONT COLOR="#008080"></TD>

<TD></TD>

</TR>

<TR>

</TR>

</TABLE>

<BR><BR>

<CENTER><B>To register for this event,

<INPUT TYPE="submit" NAME="-View" Value="Login to Register">

</FORM>

</CENTER>

<CENTER><B>Use the browser's BACK button to return to the search results.</B></CENTER>

</BODY>

</HTML>

Thanks for looking........Donna

Posted

HI......

I was in a dilemna over whether or not it should be -view or -find.

I picked -view because the CDML reference says that -view is "....Used to process any format files that do not require record data."

This page does not require the processing of data. It just needs to pass the search criteria from the previous page to the tokens.....etc.

Maybe, there is a better way to do this?^_^??

Donna

Posted

To perform a -find you need to submit data to be found. Not needed, not what you want.

-view does leave a lot to be desired.

-findall is possibly the action you desire.

Posted

Leb i Sol, I tried your suggestion of moving the return false; it didn't seem to help. Same problem.

I don't think -FindAll is the solution since I have already done my search on the page before.

Any other suggestions?^_^ Donna

Posted

My observations on -view, -findall and -findany based on testing.

1.a -layout. I tried the same link with and without -layout. The -layout tag had no effect one way or the other when used with the action tag -view in a link.

1.b I also tested as a form both with and without the -layout tag. Again the -layout tag had no effect one way or the other. Just because it is not a "Required tag" does not mean it cannot be used.

2. -view is an action tag. It's action on the db file is not discernable. On the results page I first tried to display a field, and no data appeared. I next tried to show the FMP-CurrentRecID and the result was the display of -1. I also established that a -token could be passed and displayed on the results page. One could conclude that the -view action is equivalant to "do nothing to the db file".

3.-findall is an action tag. It's action on the db file is discernable. Its action is like "show all records" but starting with the first record.

4. -findany is an action tag. It's action on the db file is not discernable. On the results page one can display data from what appears to be a randomly selected record in the db file. If one is looking at the db file while invoking this action, one is likely to be looking at a record which is different from the data being displayed by the browser.

Posted

One other thought, regarding the "X" of elemen[5].

If the X is in a field of the record when the class is full, JavaScript can probably be avoided and the appropriate text can be displayed on your results page (... since I have already done my search on the page before.) with an FMP-If conditional.

Posted

Hi Donna!

I must agree with mr.Unable ...I thought I mentioned this option here but I guess it din't work out....

how aboout:

<script language="JavaScript">

function myFunc()

{

if (document.form1.f1.value=="X")

{

alert("Class Fulll!.");

return false;

}

else

document.form1.submit();

}

</script>

</head>

<form name="form1" method="post" action="" onSubmit="return myFunc();">

All the best!

Posted

Regarding my observations on -findany.

This action tag will allow the display of data from a randomly selected record.

Because the record is randomly selected, and because there have been several queries on these forums regarding the display of randomly selected records (plural), I have done some further testing.

I tried the display of results in a table such as one might normally use to display multiple records' data. Data from only one record was displayed. I then added the -max tag in both the link and the form and tested again.

I can report that the -findany action returns results for just one randomly selected record when approached from either a link or a form. So in that usage it is not possible to display data from plural random records.

However the -findany tag is very effective for displaying data from a completely randomly selected single record. laugh.gif

FWIW all referred testing was performed in FMPro 5.0v.3 with latest WC updater.

Posted

Thanks to all for your input......I have tried everything that was recently mentioned here. Using the field doesn't work in the JS. FindAny rather than View doesn't seem to make a difference. Moving the return false to the JS rather than keeping it in the FORM statement has helped.

I am no longer getting the error message 4.......here's what it's doing now using the following code.

If the event that was found on the previous page is NOT full; I get the next page which is login.htm. Great. Wonderful!

If the event that was found on the previous page is full; I get the alert -- here's the problem now........when I click on the alert's OK button instead of going back to the same page I was just on; it goes to the login.htm page which is what I'm trying to avoid. At least, I'm not getting any error messages but I don't want to end up on the page I'm getting.

Is it possible to add something to the JS which says hey if this is false go to this page and not what is defined in format?

It's like the page is getting re-directed to login.htm.

Here's the code as it stands now........

<SCRIPT LANGUAGE="JavaScript"><!--

function verify()

{

if (document.verify.elements[5].value == "X")

{

alert ('This class is full! No registration allowed!'); return false;

}

else

{

document.verify.submit();

};

}

//--></script>

</HEAD>

<BODY CLASS="first">

<FORM NAME="verify" ACTION="FMPro" METHOD="post" onsubmit="verify();">

<INPUT TYPE="hidden" NAME="-DB" VALUE="CE_Events">

<INPUT TYPE="hidden" NAME="-format" VALUE="login.htm">

<INPUT TYPE="hidden" NAME="-lay" VALUE="Online">

<INPUT TYPE="hidden" NAME="-Token.3" VALUE="2003-TR24">

<INPUT TYPE="hidden" NAME="-Token.4" VALUE="OCLC/ILL: The New Web Interface">

<INPUT TYPE="hidden" NAME="-Token.7" VALUE="X">

Again, any help is appreciated.......Donna

Posted

I'm not a JS expert, and I have not tried this and do not know if it will work, but you may need to use the FMP-If conditional on login.htm to control a META Refresh such that ... -If: whatever.eq.X - Reload to "same page", FMP-Else display the code now on login.htm.

Posted

Use this to remain on the same page:

<SCRIPT LANGUAGE="JavaScript"><!--

function verify()

{

if (document.verify.elements[5].value == "X")

{

alert ('This class is full! No registration allowed!');

}

else

{

document.verify.submit();

};

}

//--></script>

</HEAD>

<BODY CLASS="first">

<FORM NAME="verify" ACTION="FMPro" METHOD="post" onsubmit="verify(); return False;">

Or, you can use a second Form, or URL, if you wish them to go elsewhere:

function verify()

{

if (document.verify.elements[5].value == "X")

{

alert ('This class is full! No registration allowed!');

document.otherform.submit();

}

else

{

document.verify.submit();

};

}

//--></script>

All the best.

Garry

Posted

You may also want to add this line before the end of the Form:

<input type="hidden" name="-view">

I think you may be receiving the errors because the "-view" is not being received by FM. This is because the Return key is pressed rather then the Submit button.

All the best.

Garry

Posted

how about:

==================================================

....

....

alert ('This class is full! No registration allowed!');

return false;

location.replace("http://www.your_site.com/Where_I_came_from.html");

}

....

================================

line 2 and 3 (in this snip) might need to be reveresed.

All the best!

Posted

I wouldn't usually have the "return False;" line in the script. This is because I usually use an "onClick" in a link to call the Function. I ususally have a "return False;" in the "onsubmit=" so that if an "Enter/Return" is pressed the Form is not submitted before whatever processing needs to be done. However, this is not critical smile.gif

The "location.replace" etc is good if the user is to be taken somewhere else, you can even use a "history()" function to go back or forward. Otherwise nothing is needed there, the Function should just run out of instructions after the "alert()". This is when the "return False;" is invoked (either in the Function or in the "onsubmit=").

Hope this makes sense wink.gif

All the best.

Garry

Posted

Well......here's where the problem stands now. I tried the most recent suggestions and Garry's suggestion has worked. I now can click on the submit button and it will evaluate whether or not the class is full. If it is full, I get the alert and when I close the alert now it stays on the page that I was on. Great! If it is not full, it goes on to login.htm. Great!

However, my joy at making this work has been short-lived.

I got the solution to work in IE 5.2 for the Mac. So, I went to our training center which has PCs and I tried the solution on IE 5.5 (it doesn't work). I tried Netscape 7.0 (it doesn't work). I tried Netscape 7.1 for the Mac (it doesn't work). I tried Netscape 4.7 (it doesn't work). However, IE 5.1 is okay.

I am now so frustrated I am calling it quits for the rest of the week. If anyone has any suggestion on why it would work so randomly.......I'll be all ears on Tuesday.

Thanks again for your help! Donna

This topic is 7841 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.