Brad Kennedy
asked on
How to append collected name/value pairs to iFrame source code
I have to add 2 form fields ( "Name" and "Org") to a YouSendIt iframe:
<iframe id="file_upload_iframe" name="file_upload_iframe" src="http://www.yousendit.com/ibox/v1/ibox.php?sitebox=9876543&custom_postback=true&custom_redirect=true&send_notification=true(&Name=Bob&Org=Little League"(style="display:blo ck;" width="350" height="350" marginwidth="0" align="middle" frameborder="0" scrolling="no" allowtransparency="true">< /iframe>
I've been coding ColdFusion for awhile and have some abilities scripting Ajax, but I don't know what to do.
What's the best approach for this?
<iframe id="file_upload_iframe" name="file_upload_iframe" src="http://www.yousendit.com/ibox/v1/ibox.php?sitebox=9876543&custom_postback=true&custom_redirect=true&send_notification=true(&Name=Bob&Org=Little League"(style="display:blo
I've been coding ColdFusion for awhile and have some abilities scripting Ajax, but I don't know what to do.
What's the best approach for this?
If you only have 2 fields, and you already know their names, I'd say the loop is overkill (unless you intend to increase the fields). Why not just:
<CFSET str="https://www.yousendit.com/v1/ibox.php?sitebox=9876543&send_notification=true&custom_redirect=true&name=#URLEncodedFormat(Form.Name)#&org=#URLEncodedFormat(Form.Org)#">
ASKER
I should have been more specific with my question. It's not just about appending values to a string.
I have 6 form fields in a separate form whose values must be included with the iframe form submission.
Am I correct in thinking that this will always have to be a 2 step process, i.e., 1) setup and submit the separate form to the loop, then 2) present the iframe where the user will fill in the iframe form values, and click the submit button? Is there some way to roll all of this into a single submit?
Thanks.
I have 6 form fields in a separate form whose values must be included with the iframe form submission.
Am I correct in thinking that this will always have to be a 2 step process, i.e., 1) setup and submit the separate form to the loop, then 2) present the iframe where the user will fill in the iframe form values, and click the submit button? Is there some way to roll all of this into a single submit?
Thanks.
Could the whole thing be done with javascript?
ASKER
Yes, I suspect that's a possibility. I'm a relative JS newbie, though - do you have any suggestions on how I might proceed?
Thanks.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yep, that's it, dead on. I think it's gonna work. Thanks for your help.
ASKER
Loop over the form variables and append the YouSendIt string:
<CFSET str="https://www.yousendit.com/v1/ibox.php?sitebox=9876543&send_notification=true&custom_redirect=true">
<CFLOOP INDEX="allFields" list="#Form.FieldNames#">
<CFSET str = str & "&#LCase(TheField)#=#URLEn
</CFLOOP>
Str: <cfoutput>#str#</cfoutput>
But it would be better if the entire string could be appended and submitted in one step.