Sorry for the lengthy message.
I am working with a set of child and grandchild forms for which I want to have
the AddAction page cycle back to the
calling add form. Normally we accomplish this by adding an 'Add Another'
button, and stripping the default redirectTo
attribute out of the InsertRecord tag in the action page. The PlumRoleAddForm
has an example of this technique and I
have been using it alot.
<!--- Display the Submit button, plus an "Add Another" button that enables
repetitive adding of records --->
<cf_DisplaySubmitButton buttonText="Save">
<input type="submit" value="Add Another"
onclick="objFormPlumRole.redirectTo.setValue('PlumRoleAddForm.cfm')">
</cf_DisplaySubmitButton>
This technique works well when you are using simple forms from drilldowns, but doesn't work very well with master-detail
forms because the default 'Save' button sets the redirectTo value to '', and so you can't get to where you want to go.
Another way to accomplish the same effect is to set the redirectTo attribute to
return to the add form in the IDE or via
code. This works great also and you can change the label to 'Save and Add' and
it does the same thing. However, you are
forced to use the 'Back to List' link to go back to the list. This doesn't work very well when you have 3 'Back to
List' options on one form (this is good reason to add a displayALinkToThisListLabel attribute to all of the form tags,
which I have done myself for my purposes).
So I have created a Cancel button to move me back to the form I want to call,
like so.
<cf_DisplaySubmitButton buttonText="Save and Add">
<input type="button" value="Cancel"
onclick="javascript:document.location.href='<cfoutput>#Application.absoluteUrlRoot#/admin/terminal/TerminalEditForm.cfm?TerminalID=#URLEncodedFormat(Trim(Evaluate('#Application.persistentScope#.TerminalID')))#&FromAction=1'</cfoutput>">
</cf_DisplaySubmitButton>
This works fine, but is a lot of work. I am just wondering if we can expand the DisplaySubmitButton tag in the next
version to include a redirectTo attribute so that we can handle this a little more elegantly?
BTW, somebody else figured out a better way to handle this without modifying
the DisplaySubmitButton tag?
Thanks,
Jeff
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************