Jump to content
Server Maintenance This Week. ×

FMP Creating New Record on Browser Reload


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

Recommended Posts

I am running into a problem where all files which have referring pages that have -new commands will also create new records when the reload button is clicked on the broswer.

For instance, if the customer purchases something, they click the purchase button and it will create a new invoice and take them to an invoice screen. While viewing the invoice, if they hit the reload button, it will create a new invoice for them with the same item(s) on it.

This is happening wherever the referring page has a new record command.

Is there any way to tell the broswer that if the last action was a reload, to not create a new record?

Link to comment
Share on other sites

quote:

Originally posted by Rick:

hi, you might want to try a java script. I am having the same problem.. but i have not tried this java script yet!


Also, instead of using a dynamically created link , you might want to use a form post instead... this would work better with that script, which I just tested and it works great!

Link to comment
Share on other sites

That script won't work. frown.gif

What do you mean a form post instead of a dymanic link? I thought that was what I was already doing...

Page one has a form that creates a new record when submitted (isn't that what you mean by a form post?) and then refers you to page two. If page two is reloaded or refreshed, it will create a new record again. I don't know how to keep it from doing that. What exactly did you do that worked?

Link to comment
Share on other sites

This is what you might be able to do... The java script simply prevents the user from clicking submit several times.. I guess it doesn't do anythign for reload.

A form submition is when the web user, enters a value in a field. A link submition is when you enter the value and placed it as a link that the user clicks on. The advantage of the form is that when the user hits reload, they get a message that says repost data? or somethign like that.. the link on the other hand, simply creates a record without a warning.

This is what you might want to try...

create a global field for each field that you want to submit info from the web page. (for instance, client ID, Password, etc.), change the -New tag, to -Edit, and point the page fields to the global fields. When they click the submit button, they'll simply be changing the global fields... then add the -Script tag to the page to be submited with the -Edit request. (you will need to include a RecID tag as well) You might want to leave the first record blank to acomplish this task and use that as the record number to edit, unless you are able to point to the right record)

Create a script on the database that is run after the edit is done, tell the script to find the information you received on the global fields on it's corresponding field i.e.

Set error capture on

enter find mode

set field Client Id to GlobalClientID

PerformFind

If(Currenterror)=401

New Record Request

set field Client Id to GlobalClientID

Exit Record request

Else

Exit Script

This will need some work I am sure, but I think it should work.

Rick

Link to comment
Share on other sites

  • 2 weeks later...

tmanning, you wrote, "...will also create new records when the reload button is clicked on the broswer."

I am having a similar problem, so I would like to know which of these assumptions describes your work:

1. You are in development and not yet working directly on the web.

2. You are in development using Netscape.

3. When the reload button is clicked, you are also holding the option key.

4. Following reload you get the message "Request form data"

Thank you.

Keith M. Davie

Link to comment
Share on other sites

1. You are in development and not yet working directly on the web.

- I am in develpment but one of the projects has already gone live.

2. You are in development using Netscape.

- I am using both Netscape and IE when testing, but mostly IE.

3. When the reload button is clicked, you are also holding the option key.

- The same happens when I refresh using the option key or not.

4. Following reload you get the message "Request form data"

- Yes I am getting that message. That's the one that I would like to get rid of and just have the data not repost at all. I think that message is so common that users, by default, just hit OK. Also, since the problem in not occuring on the actual form page, but rather from the URL that the user was directed to, they don't actually see the form anymore and therefore, assume that there is no data to be posted again. Does that make sense?

Anyway, I am not sure why a user would refresh a "Thank you" screen. It's just that I have been refreshing it while in development and that's when I noticed the problem. Trying to think in advance of how to error proof the program, I thought it would be wise from blocking a user from doing that - just in case.

The gentleman that answered two replies ago gave me a great stop gap to keep it from happening within the database but it would be even better if I could stop from happening to begin with by desabling the broswer from repostig data at all.

I hope this helps you to help me with my problem. Thanks a ton!!!!

Link to comment
Share on other sites

  • Newbies

i'm fairly new to CDML development and have encountered the problem you are having with new records being generated upon reload. this is my first attempt at building a Web interface with FileMaker and i'm not very pleased with their sparse CDML documentation or the example files they supplied. following their example files created the new record generation on reload problem. i tried the FMP-if tag that Mike H. submitted but i couldn't get it to work, so i wrote the following JavaScript to use in my format files:

<script language="javascript" type="text/javascript">

function reloadEditMode() {

if (location.search == '?-db=filename.fp5&-lay=layoutname&-format=filename.htm&-new') location.replace('[fmp-link:a]&-recid=[fmp-currentrecid]&-edit');

}

</script>

<body onLoad="reloadEditMode()">

the script forces the browser to reload immediately in edit mode with recid, preventing new records from being generated with successive reloads.

now, the record generation problem was not the problem that initially led me to the FM Forum. i CANNOT assign a value to a token. i am attempting to assign the currentrecid to a token in a hidden field and the value will not assign. i can make the currentrecid display on the page, i can assign the currentrecid to other hidden fields and their values will display on the page, but the token value refuses to assign.

ever hear of anyone else having such a problem? i would appreciate any clues or direction you or anyone else might be able to provide.

Link to comment
Share on other sites

tmanning, thanks for responding. I am having the same problems and am trying to avoid the use of JavaScript. I am looking for an answer and will post if/when I get one.

wayking, I have studied the passing of the -token. This is what I have observed.

1. I use a straight html link "a href" from the home page and get to the first format file (1). It has a form action in which the code is written:

<input type="hidden" name="-token" value="[fmp-currentrecid]">

<input type="hidden" name="-recid" value="[fmp-currentrecid]">

When the form is activated (button clicked) action is taken on the designated db and information is captured for the designated format file.

2. The next format file (2) will display, if requested by [fmp-field: currenttoken] the code [fmp-currentrecid]. If you also requested [fmp-field: currentrecid], you would find the internal record number displayed. The reason for this, as far as I can tell, is the token is assigned by the format file and the recid is assigned by the database. Thus since the format file (1) which first describes the token is not relating to a database, it has no recid to capture, so when activated the cdml tag is captured as the token.

3. Now, if in the format file (2) you repeat those same two lines of code in another form action which calls the same database, when that form is activated, the next format file (3) will display the token as the recid which is captured format file (2).

Confusing, you bet! "Sparse cdml documentation", quite the understatement

Link to comment
Share on other sites

In furtherance of my response to wayking of yesterday, I erred. I was working off the top of my head when I wrote;

"1. I use a straight html link "a href" from the home page and get to the first format file (1). It has a form action in which the code is written:

<input type="hidden" name="-token" value="[fmp-currentrecid]">

<input type="hidden" name="-recid" value="[fmp-currentrecid]">

In fact, I actually had written the code:

<input type="hidden" name="-token" value="[fmp-currenttoken]">

<input type="hidden" name="-recid" value="[fmp-currentrecid]">

in the first form action.

I went back and changed that today to that which I posted previously and, as a matter of fact, the "[fmp-currentrecid]" did display the internal record number, and it continued to do so thereafter as I remained in that db.

What this tells me is to be certain that you have described the token with the value "[fmp-currentrecid]" and not the value "[fmp-currenttoken]".

Again I hope this helps. Sorry for leading you down the primrose path.

Peace

Keith M. Davie

Link to comment
Share on other sites

Yesterday I attended DIG-FM in Santa Clara. Though I got home at midnight and had to be up at 5:15 AND the featured guest was, unfortunately, unable to show, I was able to posit the "reload" question.

Interestingly, the document at FileMaker (Article Number: 105652) recomends the deletion of the META tag.

I was advised (by the employee of FileMaker) to go to www.blueworld.com for a discussion on this subject which necessitates the inclusion of a META tag.

I have not checked this out yet, however, you may want to explore from:

http://www.blueworld.com/blueworld/default.html

search in "subject": reload

Peace

Keith M. Davie

Link to comment
Share on other sites

  • 4 weeks later...

In response to wayking's trouble with tokens...

"i CANNOT assign a value to a token. i am attempting to assign the currentrecid to a token in a hidden field and the value will not assign. i can make the currentrecid display on the page, i can assign the currentrecid to other hidden fields and their values will display on the page, but the token value refuses to assign."

The CDML reference has this exact example! To set the token in a form, use the CDML...

<imput type="hidden" name="-Token" value="[FMP-CurrentRecID]">

... while to do the same thing with a link, add the url text...

...&-token=[FMP-CurrentRecID]...

Hopefully that should work.

Link to comment
Share on other sites

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