EddyB Posted April 14, 2003 Posted April 14, 2003 Hi all, I desperately need help with 2 problems please, so I hope someone can help! 1) I have set a database up on the web. To submit a new record you need to enter information into 4 fields. The 4 fields are set up as required fields. Therefore if you miss a field you get an error page for required information. That all works fine. Now, the search page contains the same 4 fields, at the moment you can enter information into any of the 4 fields, press search and up comes the search results page. I need it so the user HAS to enter information into ALL 4 fields before they can search. i.e. they need to search on all fields not just 1 of the 4. In normal forms (not using FM) I use a piece of javascript using the command onSubmit. When the user submits the form it calls for the 4 fields to be checked to make sure they are not empty, if they are then a dialog box is displayed telling them they have missed required information. This code works fine normally. But when I try to put this code into my database search page it ignores it. It seems as though it is seeing Form Action="FMPro" and dealing with this, totally ignoring my onSubmit command! So the question...finally! is how can I make it so that the user has to enter search criteria in all 4 fields before they are allowed to submit their search? 2) The database I have written is for an online exam. After the user has submitted their data, it brings up a page with their results. At the moment, if they are not happy with the result they can just click back and amend their record! I have looked into this I as far as I can see I have 2 options: a) To open the test in a window where the navigation bar is ommitted, but users can still get back by right clicking (windows) or alt and click (mac). It is quite a serious testing program so there can be no little hidden tricks like this allowed! When the user submits their data it takes them to a page which automatically redirects them to their results. This way, if the user clicks back it will take them to the redirect page and straight back to their results effectively putting them in a loop. But I have seen this before and if you click back twice quick enough you can get back to the page so - useless! Anyone got any ideas how I can do this so that if the user clicks back they cannot get into their submission maybe a page which says this page has expired or something like that! Any help on this would be greatly appreciated. Many thanks EddyB
Unable Posted April 14, 2003 Posted April 14, 2003 1) JavaScript is the answer. Check your code. 2) I know of one way to do this using FileMaker, but it is a "proprietary" solution which I am not at liberty to give away - sorry. So I too am curious to see what the gurus have to offer.
EddyB Posted April 14, 2003 Author Posted April 14, 2003 OK so I checked my code and I had messed up! sorry! I was convinced it was right! Just point 2 I need help with now then! Thanks EddyB
Garry Claridge Posted April 14, 2003 Posted April 14, 2003 You could use a unique recordID so that if the answers are re-submitted an attempt to create a new record is made. If the record exists (i.e. already submitted) an error is returned. Good Luck. Garry
Anatoli Posted April 14, 2003 Posted April 14, 2003 The location object's replace() method overwrites the current history entry with the specified URL. It removes the current history entry before the next URL is loaded. Removing the item from the history list also prevents users from seeing the page again by clicking on the Back button later. This technique is very useful for online games and multi-page forms, where you want prevent the user from returning to the previous page. Furthermore, the location.replace() method is supported by all browsers except Navigator 2.0x. The following example shows how to use this method in a link: <A HREF="javascript:location.replace('nextpage.html')">Advance</A> HTH
EddyB Posted April 14, 2003 Author Posted April 14, 2003 AMAZING!! Thanks! I have used this in the form of Form Action="FMPro" onSubmit="javascript:location.replace('nextpage.html')" This takes them to the results page. When they try and click back they are directed to another page not their answers! OK nothing to do with FileMaker but.. when it takes them to the page I have directed them to, I need that page to automatically refresh wheh the user enters it. I have used: <meta http-equiv="refresh" CONTENT="1"> But this refreshes the page every second! I just want it to refresh once when the user first enters the page. Any ideas? Many thanks again EddyB
EddyB Posted April 14, 2003 Author Posted April 14, 2003 Sorry, forgot to mention, <meta http-equiv="refresh" CONTENT="1"> causes an unexpected error in FileMaker error number 4 Thanks EddyB
EddyB Posted April 14, 2003 Author Posted April 14, 2003 OK it caused an error as I had not specified a valid URL! But still it just keeps refreshing every second. As I said, I need it to just refresh once. EddyB
Anatoli Posted April 15, 2003 Posted April 15, 2003 This meta can't do that. Why your page is not refreshing? Was it accessed before and is it cached?
cjaeger Posted April 15, 2003 Posted April 15, 2003 maybe you better specify a <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> in your HTML. This prevents caching and loads the page every time it is accessed.
EddyB Posted April 15, 2003 Author Posted April 15, 2003 Yes that's right. I'll explain how it works: Users enter a new record - this registers them to take the exam. Users 'login' basically all this is is searching for their record! Record_detail page brings up which exam they are due to take next. They click onto the link for that exam and it brings up the questions - this is basically the edit record page! They click on submit - Edits record - takes them to the results page showing their score. Now if they were not happy with their score they could have clicked back and amended their answers and just edited the record again so I used your suggestion Anatoli. When they click the button to edit the record (submit their answers) I have added to the form tag onSubmit="javascript:location.replace()" They still get to their results page, but if they click back it does not take them back to the questions as this has been erased from history, it takes them back to the page which shows them which exam they need to take next (record_detail page). But because they have just gone back it has not refreshed and so it still showing the exam they have just taken as being their next exam. Once FMPro knows the answers have been submitted (record edited) it changes a field. This field is the URL for what the next exam link points to) So because the page has not been refreshed the link is still to the previous exam - even though the field on the database has changed to the next exam. Does that make sense? So basically after they submit their answers it takes them to their results page, if they just press continue it takes them to the record detail page showing the next exam correctly. But if when they get to their results page they press BACK it misses out the page of their answers, goes back to the record detail page but is not showing the up to date information as the page is cached. Hope you can help Many Thanks EddyB
Anatoli Posted April 15, 2003 Posted April 15, 2003 Try: <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> IE usually ignores the first META. This way it should work. HTH
Recommended Posts
This topic is 7884 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 accountSign in
Already have an account? Sign in here.
Sign In Now