Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

VERY unexpected result with a submit form.


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

Recommended Posts

Posted

I was working on a cdml layout that included a pretty standard form. An example:

<form action="FMPro" method="post">

<input type="hidden" name="-DB" value="@task.fp5">

<input type="hidden" name="-Format" value="main.htm">

<input type="hidden" name="-RecID" value="[FMP-CurrentRecID]">

<input type="text" size=12 name="Country" value="[FMP-field:Country]">

<input type="text" size=12 name="Contacts 3::State" value="[FMP-field:Contacts 3::State]

<input type="submit" name="-Edit" value="Edit This Record">

Now when the page is viewed the two fields are populated from the FileMaker database. One field is from the main database, one field is in the same layout in the main database but is a related field. You can of course edit the text, hit the submit button and the record is updated.

The odd behavior is that the main database is updated, but for every time I hit the submit button, a new record is created in the related database.

I dont get it. I have read thru different posts and thru the CDML literature, but still dont understand why this is happening. Any suggestions would be appreciated.

Larry

Posted

Perhaps using

<input type="text" size=12 name="Contacts 3::State" value="[FMP-field:Contacts 3::State.1]">

will force FileMaker to enter the data into the first related record, if you're using v5+.

Posted

Again, one of those odd things in filemaker that should not be happening. Anyway, the above suggestion worked, but I had to invert it as such:

<input type="text" size=12 name="Contacts 3::State.1" value="[FMP-field:Contacts 3::State]">

Thanks for the help.

LR

Posted

OK, so here is a wrinkle to all this.

<form action="FMPro" method="post">

<input type="hidden" name="-DB" value="@task.fp5">

<input type="hidden" name="-Format" value="main.htm">

<input type="hidden" name="-RecID" value="[FMP-CurrentRecID]">

TABLE ITEMS

<input type="submit" name="-Edit" value="Edit This Record">

Where TABLE ITEMS is a table representing a portal. I am of course using the proper [FMP-Portal:Contacts 3][/FMP-Portal]

My table then holds items such as

<input type="text" size=12 name="Contacts 3::State.1" value="[FMP-field:Contacts 3::State]

Here is the problem. If I have multiple items showing in my portal in my database, they of course also show up on my web page in my table. I can make edit changes to line one in the table, hit submit, and the change is submitted to the database. But if I try to edit anything from line 2 and on, hitting the submit button does not submit these changes to the database.

My guess is it has something to do with the .1 added in the cdml tag. How can i possibly get past this so that I can edit each line of the portal via each line in my table on my web page?

LR

Posted

Larry, I referred you to a techinfo article which discusses this and presents an example which uses:

Phone::PhoneNumber.0

Your code shows:

Contacts 3::State.1

Why would you not think to use:

Contacts 3::State.2 ?

(Though for web use I would have used "contacts3" or "contacts_3")

Posted

Read the article.

Tried many variations including:

Contacts 3::State.0

Contacts 3::State.1

Contacts 3::State.2

Contacts 3::State.1 just allowed the editing of row one of the table. This would be row one of the portal in the database.

Contacts 3::State.0 and Contacts 3::State.3 actually did not edit the record, but instead created an entire now portal record with the new information, leaving the original portal record untouched.

LR

Posted

I had the same problem. Adding a .0 or a .1 after the field name did not help. I ended up making an edit.htm page linked directly to the related file, where the user can edit the items then return to the main page.

Posted

Anatoli,

Thank you. That one clarified it. I am assuming by manually adding something like .1 to the cdml it is hardcoding it to portal row 1. So even if in my table on the web page if I make changes to row 5, it is trying to submit the changes to row 1. By adding .[FMP-CurrentPortalRowNumber] to the solution, now each row in my table has the correct corresponding .# assigned to it.

It makes good sense how this works now. Thanks again for the insight.

Larry

Posted

The ".0" actually represents a new row. Unfortunately, this is a little illogical because we usually associate a new row appearing at the bottom of the portal. However, it is easy to use if you do wish to create a new row.

All the best.

Garry

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