function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FinnArildFinnArild 

Posting value from query string into a hidden field

Hi - we have a Customer Portal/Site setup where we want students to give anonymous surveys of the different seminars. We want to send them a mail with a link to a form that automatically selects the seminar - where they can fill out the data. So - I want to pass the reference to a seminar in an url string - which should be really, really easy - but I just can't seem to figure it out. Below is my current code - what the hickory am I doing wrong?

 

 

<apex:page showHeader="false" standardController="Survey__c"> <script type="text/javascript"> document.getElementById('Seminar__c').value ='{!$CurrentPage.parameters.Seminar}'; alert("What the heck !"); </script> <apex:stylesheet value="/dCSS/dStandard.css"/> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > {!Survey__c.Seminar__c} <apex:pageBlock title="Please fill in this survey"> <div class="field"> <label class="formQuestion" for="">Seminar</label> <apex:inputHidden value="{!Survey__c.Seminar__c}" id="Seminar__c"/> <!-- <apex:inputField value="{!Survey__c.Seminar__c}"/> --> <!-- <input type="hidden" name="j_id0:SiteTemplate:j_id7:j_id8:j_id10" value="{!$CurrentPage.parameters.Seminar}"/> --> </div> {!$CurrentPage.parameters.Seminar__c} <apex:commandButton action="{!save}" value="Save Survey"/> </apex:pageBlock> </apex:form> </apex:define> </apex:composition> </apex:page>

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
FinnArildFinnArild

Omg! Excuses for not finding this must be:

  1. I must have been very tired last Friday
  2. It was too easy
I can of course create my custom save action in the controller and get the query string parameter with ApexPages.currentPage().getParameters().get('Seminar')

Solved it myself!

All Answers

FinnArildFinnArild

Omg! Excuses for not finding this must be:

  1. I must have been very tired last Friday
  2. It was too easy
I can of course create my custom save action in the controller and get the query string parameter with ApexPages.currentPage().getParameters().get('Seminar')

Solved it myself!
This was selected as the best answer
lopezclopezc

Hi! I have a very quick question. How do you set your seminar parameter to be passed to you site?

 

My site is something like http://mysite.force.com/seminars  and I would like to pass a parameter. http://mysite.force.com/seminars?id=20394203489  doesn't work for me. Any ideas?

 

Thanks!