We help IT Professionals succeed at work.

Passing tag from my host to a form on another host

176 Views
Last Modified: 2010-04-06
I am using a template from Homestead.com that has a tag called:

"$customer.FirstName", which would display the first name on a form that I have hosted on the Homestead host.

I have my form, however, located on Pair.com as its host because Pair offers the cron job capability.  I'd like to pass $customer.FirstName to this form... as I have the form IFRAMED within my Members Area template so that the form looks like it is part of the same site.

Could anybody help?  I believe this syntax must be simple, but I'm just not sure where to look for it.

Thank you in Advance!
Chad
Comment
Watch Question

b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
Unless the provide a way to get it from the URL you will not be able to do it.  Browser security prevents client side scripts, like Javascript, from accessing or manipulating content on a different server, domain or protocol.  It is considered cross-domain scripting.

Unfortunately there is no way to tell if a page would take query string info in to a form just by looking at the html.  It is the server script that would do it (in almost every case) and that isn't something the user sees.  If you want to pursue that option you would need to contact the site's owners/webmaster to see if it is an option.

bol
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hey there Shalomc,

I like it... I will give this a shot.  I was thinking there was some kind of parameter passing capability.  Unfortunately, the Homestead has their lips stapled shut as to how to do it, so I'm kinda left hanging.  Will report back as to whether this works.  I already am using an iframe, so now just need to see if the additional syntax will be recognized.

Chad

Author

Commented:
Hello again Shalomc,

I think this is the right track, as essentially what I'm trying to do is pass a value... $customer.FirstName to an index.htm file that is IFRAMED.

Are there any caviots to using an htm file versus a php or asp file- at least in the context of being able to pass my value.

I've tried the syntax above and it's not working, but I'm sure it's gotta be close.

Here's what I tried:

<IFRAME name=inlineframe src="http://site.com/form?First_Name=value-of-$customer.FirstName" frameBorder=0 width=1100 height=1150> </IFRAME>

also

<IFRAME name=inlineframe src="http:/site.com/form?First_Name=$customer.FirstName" frameBorder=0 width=1100 height=1150> </IFRAME>

and

<IFRAME name=inlineframe src="http://site.com/form/index.htm?First_Name=value-of-$customer.FirstName" frameBorder=0 width=1100 height=1150> </IFRAME>

The IFRAME display fine,  but the first name doesn't get displayed, or appear to be passed... perhaps it is being passed, but not displayed?  Not sure since I don't see it.

Thank you in advance,
Chad
CERTIFIED EXPERT

Commented:
Chad,
This requires some programming in several places.

Let's suppose that the page where the iframe is to be inserted has access to a variable called $customer.FirstName

If you manage the code at the server side (php, asp, jsp, java or whatever) then the server code should create the IFRAME element with the correct value.

If you don't manage code at the server side but javascript on the web page has this variable, then something like this:

formIFRAME = "<IFRAME name=inlineframe src='http://site.com/form/index.htm?First_Name=' + encodeURIComponent($customer.FirstName) + "' frameBorder=0 width=1100 height=1150> </IFRAME>" ;
...
document.write(formIFRAME);


Then comes the tricky part. Your html file on pair.com must be able to extract the values passed to it
assuming that your form is first with element $Customer.name in it:

fullurl = parent.document.url ;
document.forms[0].$Customer.name = decodeURIComponent(fullurl.substring(fullurl.indexOf('?')+12, fullurl.length) );


See
http://www.webmasterworld.com/forum91/216.htm
http://xkr.us/articles/javascript/encode-compare/

Hope it sets you on the right path :)

ShalomC

Author

Commented:
Hi Shalom,

I finally figured it out... I appreciate you responding.  Here's what I ended up with:

I actually ended up taking a different approach.  I could access a member_id so used the following syntax to pass my value:

<IFRAME name=inlineframe src="http://site.com/form?Member_ID=# frameBorder=0 width=1100 height=1150> </IFRAME>

Then I put the following piece in my form:
<INPUT type="hidden" name="Member_ID" value="<?=$_GET['Member_ID']?>">

Then to display existing information from my database on my form that is unique to my member_id, I said:

<td><INPUT type="text" name="First_Name" size="15" maxlength="20" value="<?=htmlspecialchars( $data[First_Name] )?>"></TD>

etc.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.