• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 15. Web Publishing > Editing Data with CDML

Editing Data with CDML

Once visitors have found the record that holds the desired contact information, they still need to be able to see the record itself, and then be able to edit it. For this, you need a separate format file. This format file uses replacement tags (in addition to the action and variable tags we've already seen) to display data from your database.

To create an edit format file:

Open your text editor and follow the instructions in “To create a basic Web page” on page 314.

Follow the instructions in “To create a CDML form header” on page 315.

Since all of the header information is the same except for the name of the format file that will follow this one, customize the information by inputting a new file name in the format line (Figure 15.46):

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

Figure 15.46. When the current format file is completed successfully, the file named in the “-format” tag will run.

You need this line to tell FileMaker which record can be edited. The replacement tag [FMP-currentrecid] is a placeholder for the current record (the one in the user's found set).

<INPUT TYPE="hidden" NAME="-RecID" VALUE="[FMP-currentrecid]">

Position your cursor just before the </FORM> close tag and insert a line of HTML text prompting visitors to edit their record (Figure 15.47):

<P>Please edit your information.</P> 

Figure 15.47. Be sure to insert your code before the </FORM> tag, or it won't appear as part of your Web page form.

Next we'll add the code that displaysthe visitor's record in the form. Following the prompt line you just created in the previous step and above the </FORM> close tag, add the lines of code shown below and in Figure 15.48.

Figure 15.48. The SIZE code determines how much space is allotted to display the field.

These <INPUT> tag lines are basically the same as the field code for the webguest.htm format file we created in “To create a search format file” above, with one exception: We add the VALUE= “[FMP-Field:]” command inside the tag. This command prompts FileMaker to display the contents of the fields from the found record in the database.

<P>First Name: <INPUT TYPE="text" NAME="FirstName" VALUE="[FMP-Field:FirstName]" SIZE=20></P>
<P> MI: <INPUT TYPE="text" NAME="MI" VALUE="[FMP-Field:MI]" SIZE=5></P>
<P>Last Name: <INPUT TYPE="text" NAME="LastName" VALUE="[FMP-Field:LastName]" SIZE=20></P>
<P>Address: <INPUT TYPE="text" NAME="Address" VALUE="[FMP-Field:Address]" SIZE=20></P>
<P> City: <INPUT TYPE="text" NAME="City" VALUE="[FMP-Field:City]" SIZE=20> State: <INPUT TYPE="text" NAME="State" VALUE="[FMP-Field:State]" SIZE=5> Zip: <INPUT TYPE="text" NAME="Zip" VALUE="[FMP-Field:Zip]" SIZE=20></P>
<P>Phone: <INPUT TYPE="text" NAME="Phone" VALUE="[FMP-Field:Phone]" SIZE=20></P>
<P>Email: <INPUT TYPE="text" NAME="EmailAddress" VALUE= "[FMP-Field:EmailAddress]" SIZE=20>
Web: <INPUT TYPE="text" NAME="WebAddress" VALUE="[FMP-Field:WebAddress]" SIZE=30></P>


To create a Submit button, add this line after the <INPUT> tags:

<P><INPUT TYPE="submit" NAME="-edit" VALUE="Submit">

The –edit tag tells FileMaker to update the data in the record with the entries made in the form (Figure 15.49).

Figure 15.49. Submit automatically creates a Submit button.

Add this line below the submit line:

<P><INPUT TYPE="reset" VALUE="Clear Form">

This will clear the fields on the form, allowing the user to start over.

Save the file to your Web folder. We've called our example findedit.htm.

You'll need a format file to tell the user that the data was updated successfully. Follow the steps in “Create a response message format file” above. Replace the message text with a message that acknowledges that the changes were made successfully (Figure 15.50). In our example, we've inserted:

<P>Thanks. Your changes have been added.</P>

Figure 15.50. The response format file is just a standard HTML page with a text message.

Save this file to your Web folder. For this example, we'll name it editresp.htm.

Open your default home page.

Add this line to create a line of text within the Body part containing a link to the find format file:

Locate your name and <a href="webfind.htm"> update your information</a>

Format the text line as you'd like.

Save the default page. When you access the default page in your Web browser, you will see the new choice (Figure 15.51).

Figure 15.51. With the additional code, the default Web page displays the link to the webfind format file.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint