Skip 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.

-Edit and -New question

Featured Replies

Is there a way when submitting a -edit form to have a new record created when going to the subsequent -format page?

In otherwords, right now when I am looking at a particular record through the web, I can make changes to that record, hit submit and -edit takes place. I am then sent to a -format page. I want the -format page to actually be a new record that gets created using some data from the -edit page.

Right now I have accomplished this by making my -format page use a redirect script. So I hit submit -edit, goes to a -format page which looks at field from my -edit page, the field contains the url info needed to redirect to a new record. Just wanted to know if I could do this without having to go to a redirect page first.

LR

A [FMP-InlineAction] in the Format file may work. Worth a try!

Good Luck.

Garry

  • 1 month later...
  • Author

I have been doing some reading on the inline actions, and am not quite sure how it would accomplish what I need. I currently am doing the following:

Step 1. Submit a form. It includes all the usual tags including:

<INPUT TYPE="hidden" NAME="-format" VALUE="surveyredirectintro.html">

<input type="submit" name="-Edit" value="Continue">

Step 2. Once the form is submitted the browser goes to surveyredirectintro.html. This page contains a redirect script that looks like:

<body onLoad="MM_goToURL('self','[FMP-field:Ifredirect3]')

Basically the web user is then directed to a new url that is generated by FM depending on the information from a field in the record they just submitted to in "Step 1" above. The URL information in the FM Field is dynamically generated and looks like:

http://myipaddress.com/fmpro?-db=Answers...html&Record ID=32842&-new

I just wanted to know if it was possible to skip "Step 2" completely. In "Step 1" when the -edit form is submitted, is there a way that the user could then be directed to a url based on the contents of [FMP-field:Ifredirect3] field from the record they just submitted information to?

LR

You could try [FMP-Include] with [FMP-If] in the first Format file.

[FMP-If:Ifredirect3 .eq.xyz]

[FMP-Include: xyz.html]

[FMP-ElseIf:Ifreditect3 .eq.abc]

[FMP-Include: abc.html]

[FMP-Else]

[FMP-Include: other.html]

[/FMP-If]

Good Luck.

Garry

  • Author

What would this Include do?

When the user hits the submit button on the form, instead of going to the -format file would it go to the URL contained in the field Ifredirect3?

Where would I put this code? Would it replace the VALUE for the -format?

Instead of

<INPUT TYPE="hidden" NAME="-format" VALUE="surveyredirectintro.html">

would it be something like

<INPUT TYPE="hidden" NAME="-format" VALUE="[FMP-If:Ifredirect3 .eq.xyz]

[FMP-Include: xyz.html]

[FMP-ElseIf:Ifreditect3 .eq.abc]

[FMP-Include: abc.html]

[FMP-Else]

[FMP-Include: other.html]

[/FMP-If]

">

It was my thinking that the -format could not be an entire address, just the name of a specific html page, thus the need for a page with a redirect.

LR

Whoops, I misunderstood the requirement.

Try this in the Format file returned from the "-edit":

[FMP-InlineAction: -db=Answers.fp5, RecordID="{CurrentRecID}", -new]

[/FMP-InlineAction]

Good Luck.

Garry

Hi, Larry & Garry!

... is there a way that the user could then be directed to a url based on the contents of [FMP-field:Ifredirect3] field from the record they just submitted information to?

Hmm... I thought INLINEs were typically independent actions that resolve without access to the previous action's variables. I would have guessed Larry's redirect was the only way to get what he wanted but I hope this works out... it's very interesting.

--ST

  • Author

Gary, so let me see if I understand what the above would accomplish:

I enter all my information in my form, and hit the form submit button. This submits all my data via -edit CDML tags. One of those tags is a -format that then loads a new html page after the -edit submit is completed.

The above InlineAction would be included in the -format html file, and it would force that html file to load information from a certain -db and a certain record {CurrentRecID and -new?

Could it just as easily be -edit or -find instead of -new?

Could I include other field information such as: Name="{Fullname}",

Could I add a [FMP-Include] between the [FMP-InlineAction] and the [/FMP-InlineAction] that would then include all this information: Name="{Fullname}", RecordID="{32836}", Qnum="{3}", -new

Where do I place the InlineAction in my html document? Does the [FMP-InlineAction] and the [/FMP-InlineAction] just go at the top of the page? Or does the [FMP-InlineAction] and the [/FMP-InlineAction] have to incompass my form?

Thanks for the help.

LR

Hi, Larry! INLINEs can be used for just about any action (-find, -new, -edit, -findany, etc.) but certain things like -format would be ignored if declared for the INLINE. Yes, you can add field criteria for the action in the inline but I've never tried it w/an include... but I don't see why not.

I could be wrong, but I think Garry was suggesting you put the INLINE inside the "new" form... although it is not really a "new" form since it would be creating the form and adding your info taken from the previous -edit page. That means the "new" form would actually be another -edit form that would allow the user to continue adding to the record.

INLINEs execute AND RESOLVE immediately before the HTML is generated for the page in question. AFAIK, it does not matter where on the page they are located. You can even have several INLINEs all querying the same or different databases without problem, but after they all resolve, FM continues as though they had not existed with respect to the previous MAIN ACTION. That's why I was uncertain as to the CurrentRecord reference. Normally, I think INLINEs are independent so I was curious to see if this would work.

--ST

The InlineAction will use data from the the "-edit" record. For example the "CurrentRecID" will be from the record that was "edited". You could also have values assigned to fields of the "new" record from the "edited" record by:

[FMP-InlineAction: -db=Answers.fp5, RecordID="{CurrentRecID}", mynewfield1="{Field: myoldfield1}", -new]

This Field [FMP-Field: mynewfield1] is from the new record.<br>

You can also have other CDML tags including FMP-Ifs and FMP-Includes<br>

[/FMP-InlineAction]

I would use this at the top of the page.

All the best.

Garry

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.