halbj Posted September 11, 2001 Posted September 11, 2001 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
Vaughan Posted September 11, 2001 Posted September 11, 2001 Why not use the [FMP-Portal] codes to put a portal on the web page?
halbj Posted September 11, 2001 Author Posted September 11, 2001 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.
Vaughan Posted September 11, 2001 Posted September 11, 2001 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.
Keith M. Davie Posted September 11, 2001 Posted September 11, 2001 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 ]
halbj Posted September 11, 2001 Author Posted September 11, 2001 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.
halbj Posted September 11, 2001 Author Posted September 11, 2001 Thanks Keith for the edited message! Cheers Hal.
Vaughan Posted September 11, 2001 Posted September 11, 2001 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.
halbj Posted September 11, 2001 Author Posted September 11, 2001 Thanks Vaughn I think I follow, I will let you know how I go. Cheers Hal.
Keith M. Davie Posted September 11, 2001 Posted September 11, 2001 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.
halbj Posted September 12, 2001 Author Posted September 12, 2001 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.
Vaughan Posted September 12, 2001 Posted September 12, 2001 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.
halbj Posted September 14, 2001 Author Posted September 14, 2001 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?
Vaughan Posted September 14, 2001 Posted September 14, 2001 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.)
halbj Posted September 14, 2001 Author Posted September 14, 2001 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.
Tyfud Posted September 14, 2001 Posted September 14, 2001 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).
Anatoli Posted September 15, 2001 Posted September 15, 2001 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
Recommended Posts
This topic is 8468 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 accountSign in
Already have an account? Sign in here.
Sign In Now