I have what I'm asking working but it passes everything via url variables to
the iframe but I'm afraid that I may run into url max length limitation.
This is why I was hoping to get the form field values without passing them
via the url.
Here is what I have.
This is the form page.
<script language="JavaScript">
function savenewlineitem(fieldname,fieldvalue)
{
frames['lookupformdata'].location.href =
"/templates/test-iframe-javascript.cfm?rec_command=" +
document.lform.rec_command.value + "&field=" + fieldname + "&fv=" +
fieldvalue.value + "&lid=" + document.lform.lrecid.value + "&rid=" +
document.eform.recid.value + "&pd=" + document.eform.part_date.value +
"&pn=" + document.eform.part_no.value + "&pdes=" +
document.eform.part_desc.value + "&pin=" +
document.eform.parent_item_no.value + "&qpu=" +
document.eform.qty_per_unit.value + "&w=" + document.eform.weight.value +
"&n=" + document.eform.notes.value;
}
</script>
<iframe frameborder="0" vspace="0" hspace="0" marginwidth="0"
marginheight="0" name="lookupformdata" id="lookupformdata" align="middle"
class="mini" height="0" width="0"></iframe>
<cfform method="post" id="eform" name="eform">
<textarea name="notes" rows="8" tabindex="7" cols="50" class="mini"
onblur="savenewlineitem()"></textarea></td>
</cfform>
<cfform method="post" id="lform" name="lform">
<cfinput type="text" tabindex="8" class="mini" maxlength="6" name="qty"
size="10" onblur="savenewlineitem('qty',this.form.qty)" required="Yes"
message="You must have a qty.">
<cfinput type="text" tabindex="9" class="mini" maxlength="255"
name="item_desc" size="40" required="No"
onblur="savenewlineitem('item_desc',this.form.item_desc)">
other input form fields
</cfform>
This is the iframe test-iframe-javascript.cfm page
<cfif isdefined("url.pd") and isdefined("url.pdes") and isdefined("url.pin")
and isdefined("url.pn") and isdefined("url.qpu") and isdefined("url.w") and
isdefined("url.n")>
insert url values to database.
other cf logic etc.
</cfif>
results from above logic may or may not clear the parent form fields.
parent.document.lform.qty_shipped.value = "";
parent.document.lform.qty_backordered.value = "";
parent.document.lform.um.value = "";
parent.document.lform.item_no.value = "";
parent.document.lform.vendor_item_no.value = "";
parent.document.lform.item_desc.value = "";
parent.document.lform.qty_shipped.focus();
I do not want the parent page to refresh or reload. Do you see any other
method that is easier?
Dan
----- Original Message -----
From: "lists" <[email protected]>
To: "cf-talk" <[email protected]>
Sent: Saturday, February 20, 2010 11:49 PM
Subject: RE: iframe cfscript getting parent form field values
>
> You could make this MUCH easier on yourself and just do a form POST into
> the
> iframe. Hekc, you could even use GET if you wanted to. Regardless, just
> target the iframe using JS then set hidden form fields to get passed in
> to.
>
>
> andy
>
> -----Original Message-----
> From: Andrew Scott [mailto:[email protected]]
> Sent: Saturday, February 20, 2010 10:17 PM
> To: cf-talk
> Subject: RE: iframe cfscript getting parent form field values
>
>
> No, if you are doing what I think you are trying to do then your best bet
> is
> Ajax.
>
> Once the server has processed the request, the client (browser) has
> control
> of the final request. If you are looking at populating things before the
> client receives it then you could do something like this
>
> <cfoutput>
>
> <input value="#form.someValue#" />
>
> </cfoutput>
>
> However if you are looking at trying to do this once the user is doing
> something in the form then no, you need to think about ajax and/or process
> the form by sending it back to the server to process and return the entire
> page again.
>
> You have to remember that server and client can only talk in a certain
> manner, and if I am hearing you right you are needing to understand that
> before continuing with your development.
>
>
>
>
> -----Original Message-----
> From: Dan Blickensderfer [mailto:[email protected]]
> Sent: Sunday, 21 February 2010 2:04 PM
> To: cf-talk
> Subject: Re: iframe cfscript getting parent form field values
>
>
> Can I set the form value to a cfset variable?
>
> ----- Original Message -----
> From: "Andrew Scott" <[email protected]>
> To: "cf-talk" <[email protected]>
> Sent: Saturday, February 20, 2010 10:01 PM
> Subject: RE: iframe cfscript getting parent form field values
>
>
>>
>> No,
>>
>> Cfscript is server side scripting. You need to write javascript to do
>> this
>> using document.all.form[0]
>>
>>
>>
>> -----Original Message-----
>> From: Dan Blickensderfer [mailto:[email protected]]
>> Sent: Sunday, 21 February 2010 1:40 PM
>> To: cf-talk
>> Subject: iframe cfscript getting parent form field values
>>
>>
>> Hi everyone,
>>
>> I've ran into a problem and do not know if cfscript will allow this.
>>
>> I have a page that has an iframe and a form named eform with a half of
>> dozen
>>
>> fields. I have a javascript function onblur on the last field to call
>> another cf page (page2) through the iframe. I'm trying to get cfscript
>> on
>> the page2 to get the values of the eform of the parent page and set them
>> to
>> cf variables to query data and other logic.
>>
>> Will cfscript allow this and what would the proper syntax be?
>>
>> Thanks,
>> Dan
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330992
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4