Jump to content
  • 0
Sign in to follow this  
mburns

Passing external parameter to embedded submit datapage

Question

I have a data submission datapage that I need to record the domain for. The datapage will be embedded in an HTML page used across multiple websites.

Ideally, I'd like to use a pre-existing domain parsing Javascript snippet and then pass the root domain name as a parameter to the embed.

I can't tell, though, from the embed code for the deployed datapage, how I might pass that parameter in.

Any suggestions?

Thanks,

Mburns

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I wouldn't suggest passing it (depending on how accurate you want your results) in because it can be easily changed that way.

The javascript code that gets the root domain should be included in the footer of your datapge. Configure this same datapage to include a hidden field and use some more javascript to update that hidden fields value with the root domain.

Again although I don't recommend it and I don't think Caspio was intended to even pass parameters through their embed code (it can be done)

Share this post


Link to post
Share on other sites
  • 0

I wouldn't suggest passing it (depending on how accurate you want your results) in because it can be easily changed that way.

Ugh -- yeah -- I didn't think it was a great idea either. Unfortunately, we have 11 different sites that need to share the same search/submit datapages, each one getting a domain-specific set of results from the search based on the domain stored when they submitted their data.

Now I'm looking at having to create 9 sets of search/submit datapages to populate the domain field in the shared table. 'cause I can't really think of a good way to pass in that parameter at the time of submission.

Mburns

Share this post


Link to post
Share on other sites
  • 0

The javascript code that gets the root domain should be included in the footer of your datapge. Configure this same datapage to include a hidden field and use some more javascript to update that hidden fields value with the root domain.

OK -- I get this, but how the heck do I get that hidden field to pass into the submission form? I can't access the submission form from the embed code.

MBurns

Share this post


Link to post
Share on other sites
  • 0

You use javascript to \"put\" the variable into a caspio hidden field....which will submit with the form.

Say your table has a field to hold the domain (it better) :D so include this as part of your form (make it hidden)....your javascript code you have sounds like it works to get a domain name...use javascript to set the hidden form field for domain to that value

Share this post


Link to post
Share on other sites
  • 0

OK -- here's my code that I want to drop into an HTML block at the END of the submission form:

var litesDomain = document.domain;
litesDomain = litesDomain.replace(/^www\\.|^test\\.|^dev\\./, \"\");
litesDomain = litesDomain.replace(/\\.com$/, \"\");

Now -- how can I get THAT into the hidden Caspio field ABOVE the HTML block -- litesDomain? Right now, the default parameter for that litesDomain caspio field is [@litesDomain] -- looking for a parameter to be passed in. Where do I make the link?

Thanks,

MBurns

Share this post


Link to post
Share on other sites
  • 0

You need to view source on that datapage from within Caspio Bridge to find the unique ID for that field. It will most likely be called InsertRecord_listDomain but you need to verify this.

In the view source the html code will be something similar to

Whenever you can determine what the value is for the ID property of the hidden element than adding on to your javascript is easy.

The code to add will be

var litesDomain = document.domain; 
litesDomain = litesDomain.replace(/^www\\.|^test\\.|^dev\\./, \"\"); 
litesDomain = litesDomain.replace(/\\.com$/, \"\");
document.getElementById(\"UNIQUEVALYOUFOUNDINSTEPONE\").value = litesDomain;

so replace UNIQUEVALYOUFOUNDINSTEPONE with most likely InsertRecord_litesDomain but again verify this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...