Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create related record - web

Featured Replies

Help

I have an existing web enabled database and would like users to be able to find a record, then click on a link that would take them to a new related record. Is there any fancy CDML tags that will do this?

Cheers

Why not use the [FMP-Portal] codes to put a portal on the web page?

  • Author

I don't want to use the [FMP-Portal] code because I don't want users to be able to view related records, just create them.

Ahh, create a new related record, not view them. It'll be a bit more work then.

You'll have to determine the value of the master key for the (current master) record, then use it to generate a form that (when submitted) creates a new record in the related database with the master key value inserted into the remote key field.

Not too hard, but a bit of clever logic needed.

Ahhhh. A fancy cdml tag. How about "-new"?

There are other fancy cdml tags. They are available in the cdml reference.fp5. You can find sources for that somewhere in these forums (try cdml forum). There might even be a fancy -link tag. You really should use this valuable resource Hal.

[ September 10, 2001: Message edited by: Keith M. Davie ]

  • Author

Vaughan,

thanks, I am unsure of how to get the Primary key or Record ID of the master to be auto-entered into the new related record. Any ideas.

Keith,

good one smart *** ! - See if you can understand the question and provide some sensible suggestions.

Cheers

Hal.

  • Author

Thanks Keith for the edited message!

Cheers

Hal.

This is where the "logical approach" becomes important. Think systematically.

Step one: users sees a list of records in master database. User clicks on link on one of these records which is a URL to...

Step two: view details of one master record, where we can easily determine value of the key field using [FMP-Field: key]. The "trick" is that the master record is displayed as a form for creating the related record (-db and other tags set to add record into the related database). The key field value is simply placed into a hidden code in the form for the remote key. Clicking the Submit button activates the -New action which...

Step three: creates new record in related database with key value equal to that of the master key. Display the newly created record as per the format file specified in the previous form.

  • Author

Thanks Vaughn

I think I follow, I will let you know how I go.

Cheers

Hal.

Glad to be of help Hal. I suppose I could have recommended the use of the fancy -script tag, but then you would have encountered problems because you would need to develop a fancy workaround to the single-thread engine which handles the scripts. I believe I am the only one who has developed a successful workaround. Thus I would use a script with confidence. Scripts give your db's power.

  • Author

Vaughn - This is the code I have out on the details page of the found master record. When I click submit I get an error that the "FORM.htm" could not be found.

<FORM ACTION="FMPro" METHOD="post">

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

<INPUT TYPE="hidden" NAME="-Lay" VALUE="CGI">

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

<INPUT TYPE="hidden" NAME="-error" VALUE="FORM_error.htm">

<INPUT TYPE="submit" NAME="-New" VALUE="SUBMIT">

<INPUT TYPE="hidden" NAME="[FMP-Field:RELATED::KEY]" VALUE="[FMP-Field:MASTERKEY]">

</FORM>

By removing the line:

<INPUT TYPE="hidden" NAME="[FMP-Field:RELATED::KEY]" VALUE="[FMP-Field:MASTERKEY]">

The submit works and I get a blank record created in the related record. This still leaves me with the problem of not having the foriegn key set to relate the record. What is wrong with my code.

I had a look at the inline action tag, but don't fully understand it. - am i on the right track?

Cheers

Hal.

Instead of...

"<INPUT TYPE="hidden" NAME="[FMP-Field:RELATED::KEY]" VALUE="[FMP-Field:MASTERKEY]">

...you need to specify the name of the related field. This never changes. It should be...

<INPUT TYPE="hidden" NAME="fieldname" VALUE="[FMP-Field:MASTERKEY]">

Note that it's not a related field because the form specifies the "related" database.

  • Author

thanks Vaughn,

I have got it all working, it is easy when you do it right!

I am having another problem with the -MailFormat variable tag in an email form. I have specified my text file. When I enter text into the text file, it displays in the body of the email as typed. However when i use a replacement tag within the text file eg. [FMP-Field:MailMessage], the body of the email is blank. I can't work it out. It is obviously processing the tag, or it would just display the tag as text.

I was trying to use the MailFmtField until I realised it is not supported by web companion 5.04 and later. Do'h!

Any ideas?

Is the field mailmessage on the layout specified in the -lay tag in the form? Does the field have any data in it? (Don't laugh, it's happened to me.)

  • Author

Vaughn

Yes and Yes. I checked both of those things first. But no probs I just found the problem.....

On my mail preview page I had the tag -view as the submit button. (I just copied and pasted code from my CDML Reference DB). By changing this to -Find it resolved the problem.

Thanks again for your help. - I am slowly learning the ins and outs of CDML. Love it!

Hal.

Not to confuse you further, but if you just want the user to click a link that does this. try this (fill in the blanks):

FMPro?-db=yourRelatedDatabaseName&-lay=yourLayoutName&-format=relatedEdit.htm&relatedKeyField=[FMP-Field:mainKeyField]&-new

This will create a new record in your related database with the key field value from you have currently. Then takes them to the relatedEdit.htm page which simply is an edit page that edits the record you just created in the related database (although as far as the web or FileMaker are concerned it isn't a related database anymore).

Hal

RE: I was trying to use the MailFmtField until I realised it is not supported by web companion 5.04 and later. Do'h!

This and other tags where removed because of compromised security.

Variable Tags removed from WC:

-ErrorFmtField

-FmtField

-MailFmtField

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.