Jump to content

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

Recommended Posts

Posted

I was wondering if there is a way to create a new record if the find does not have a result.

Example:

I search on first and last name but nothing comes back so it takes my find criteria and sends me to the page where I could edit the rest of the record with the first and last name already filled in.

Am I on the right track?

Posted

Easier than you think.

No records found is error 401, and the format file specified by the -error tag is returned. I'll assume it's called "error.htm".

In error.htm, put a [FMP-If: CurrentError.eq.401]. Inside the IF, put the form to create the new record with all the appropriate CDML tags.

If the error.htm file has more than one [FMP-If] -- highly likely -- ensure that they are nested something like this:

[FMP-If: CurrentError.eq.401]

form to create new record

[FMP-Else]

[FMP-If: CurrentError.eq.401]

stuff for XXX error

[FMP-Else]

general "an error has occurred" message

[/FMP-If]

[/FMP-If]

Nesting them this way, you can trap for as many error codes as you need and provide specific responses. I've trapped for 101 (record is missing), 401 (no records match request), 504 (failed "unique" field validation), 509 (failed "not empty" field validation) on the same error file, but always remember to have an "else" with a generic error message for the odd occasion that something actually goes wrong.

Posted

How do I get the first and last name to be placed in the fields of the new record page.

I guess what I am trying to do now is to create a new record and bring them to the edit page. Can this not be done? I hope I'm being clear. Let me know if you need more of an explanation.

KT

Posted

This is what I have figured out so far:

I set the input fields as tokens and then the format file does a redirect to this link:

http://xxx.xxx.xxx.xxx/FMPro?-DB=scoe_participant.fp5&-Format=scoe/duplicatecheck.html&-Max=all&first=[FMP-CurrentToken:7, URL]&last=[FMP-CurrentToken:8, URL]&-Token.0=[FMP-CurrentRecID]&-Token.1=[FMP-CurrentToken:1, URL]&-Token.2=[FMP-CurrentToken:2, URL]&-Token.7=[FMP-CurrentToken:7, URL]&-Token.8=[FMP-CurrentToken:8, URL]&-Token.9=[FMP-CurrentToken:9, URL]&-Find

It seems to go through this page fine. When it gets to the next page it goes through this check:

[FMP-If: CurrentError.eq.401]

<meta http-equiv="refresh" content="0;URL=/scoe/register.html">

[/FMP-If]

If there is a find it will display the page. If there is not a find I'm still getting the 401 error when it should be going to the redirect page . . . correct?

Any Solutions?

Thank you

Kent

Posted

quote:

Originally posted by Turansky:

[FMP-If: CurrentError.eq.401]

<meta http-equiv="refresh" content="0;URL=/scoe/register.html">

[/FMP-If]


See if the following works instead:

[FMP-If: CurrentError.eq.401]

[FMP-Header]

HTTP/1.0 302 FOUND

Location: /scoe/register.html

[/FMP-Header]

[/FMP-If]

Note: you can use a FileMaker call after Location: to redirect to another -Format file. This can be handy for editing multiple records over the web, if the user doesn't mind having the page refresh over and over and over... smile.gif

Posted

I missed one detail in your link: include an -Error= tag to call the page that handles errors.

In your case, the -Error page would be the same as your -Format page, since your -Format page is handling the error (if any).

Posted

That was the trick . . . although now I have other problems but I will work on those for awhile so I can gather my thoughts.

Thanks for the help!

Kent

Posted

Using an extension of Vaughn's solution I would do this:

[FMP-If: CurrentError.eq.401]

[FMP-InlineAction: -db={Currentdatabase}, -lay={Currentlayout}, firstname="{Currenttoken:1}", lastname="{Currenttoken:2}", -new]

[FMP-Include: edit.html]

[/FMP-InlineAction]

[FMP-Else]

[FMP-If: CurrentError.eq.0]

[FMP-Include: edit.html]

[FMP-Else]

general "an error has occurred" message

[/FMP-If]

[/FMP-If]

The "firstname" and "lastname" would need to be assigned as tokens in the original page.

All the best.

Garry

[ February 07, 2002, 05:42 PM: Message edited by: Garry Claridge ]

  • 4 months later...
Posted

Hello all,

In Netscape 4.7 on a Mac if a CurrentError 401 is found as a result of a find I get a syntax error that pops up and the person cannot complete the process. Has anyone run into this and have you found any workaround?

Thank you

Kent

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