Adding UCM web forms to Site Studio web pages

UCM has a great built-in feature for handling HTML forms called Hypertext Content Server Forms (HCSFs). They are basically dynamic server pages that are checked into the server and rendered using Idoc Script. When a form is submitted on a HCSF, the data is stored in a newly checked-in HCSP file. The data within that HCSP is contained in a XML data island. You can then render that HCSP and get access to that data through Idoc Script, render that data through Dynamic Converter, publish it with Content Publisher, or add an '?IsXml=1' to the end of the web URL to get the data back as a pure XML file. UCM even has a WYSIWYG utility to create your own forms called Web Form Editor. To read more about HCSFs, they are covered in the Dynamic Server Pages guide.

Traditionally, these forms are presented as standalone pages. They would contain the HTML form code and the <!--$idcbegindata--> ... <!--$idcenddata--> section that stores the data. They would be checked in and accessed with their web URL (e.g. http://server/idc/groups/public/documents/system/permit_form.hcsf). This works well if your form is an independent entity. But what if you want that same forms capability, but in context of a Site Studio web site?

Well, there is a subtle trick to get this to work. The form itself does not need to be rendered in an HCSF file but rather POINT to an HCSF file. So the form can be presented on a Site Studio page and have a reference to a simple HCSF file that is already checked in. To point to that HCSF, simply add the form field for 'dID' with the dID value of that HCSF. For example:

<input name='dID' value='123'>

The easiest way to get the HCSFs dID is to go to its Content Information page and look at the URL. It should reference its dID.

The HCSF itself can be very simple thanks to the ability of the ExtraRootNodes input value to dynamically add form fields to the XML data island. So the HCSF can be generic and look like:


So now all of the forms on the sites can point to this one HCSF as the starting point.

The next logical question is "Can content contributors build their own forms?". With some fancy scripting, absolutely. You can make it very simple for them to add their own forms using standard WYSIWYG contribution elements. Below are the basic steps:

  1. Create and check in an HCSF file to use as the pointer for the form. Make note of its Content ID. Here is a
    sample form
    file that will allow you to display the submitted HCSP with the form and data.

  2. Create an Element Definition based on WYSIWYG with the Form Support checkbox enabled.

  3. Create a Region Definition with the Element Definition created above. (If you want to use the sample Region Temple provided below, name the element 'Content')

  4. Create a Region Template that includes the <form> tags around the <!--$wcmElement("Content")-->. This means the contributor does not need to include the form element themselves in the content. Then include the JavaScript to add the additional mandatory fields and pick up the form fields for the ExtraRootNodes input field. Here is a
    sample Region Template

  5. If using the sample Region Template, set the 'HTMLFormTarget' variable to the Content ID of the HCSF submitted in step 1. Then set the 'ConfirmationPage' variable to the Node ID of the section to redirect to after submitting the form. Then set the 'SecurityGroup', 'ContentTitle', and 'ContentType' variables to define the default metadata for the form.

  6. Add the Region Definition and Region Template to your Placeholder Definition.

Now if users create new content, they can insert form fields and a submit button and it will become a live form.



The way this sample was created could be built in many different ways. Originally this was done as a fragment (prior to 10gR4). Or you could make the choices for the Confirmation Page and metadata as contribution elements as well in the Region Definition. So then the contributor can control those things. Or you can add custom tools in the editor to drop in validation script for the user. It could be extended in many different ways.


What should user put into the live form? Putting <form action="SomeAction" method="get" name="SomeForm"> obviously would not work. Thanks for sharing the sample.

Posted by Nathan on December 05, 2009 at 02:47 PM CST #

Hey Nathan,

If it's the user (contribution contributor) that is going to put the

into the contribution area, then the form would look like . But then they would need to 'id' the form so that you could pick it up in the scripting to add the additional form input entries.

But if you look at my example, I don't have the user add the form element at all. Instead, I put that in the Region Template for them. So they don't need to worry about it. They just need to add the form fields they want. The form field just needs the ID and the method and action are inserted using JavaScript.

Posted by kyle.hatlestad on December 06, 2009 at 01:03 AM CST #

Hi Kyle, I worked thru your example but was confused with the contributor area. I was able to bring up the contributor editor (Ctrl+shift+F5). As contributor I added a form, a form field and submit button. My question is what should I put into the form action? I tried "form_target" and I got an error: Document with Content ID 'form_target' does not match the Primary or Secondary Url at section 'Home' (Id=1) and there is no Replaceable Region defined. What did I do wrong? Also what ID I should put into the form field? Thanks for your help. It was a great post. Nathan

Posted by Nathan on December 06, 2009 at 02:19 AM CST #

I got it! Like you said, as contributor, I just add the form field and the submit button since form tag already provided by the region template. I have another question: How do I upload a file using the same template? I want to use the form to check in files. Thanks

Posted by Nathan on December 06, 2009 at 03:54 AM CST #

Well, for that you basically need to provide a form similar to the check-in form on the standard UCM page. The IdcService value would change to CHECKIN_NEW and you would need to provide the appropriate metadata for that check-in. Keep in mind this is a different service then the one used on the web form (SUBMIT_HTML_FORM). The UCM web forms are not designed to handle file uploads on the same form. If you needed that, you would need to customize that web form service to do the additional check-ins.

Posted by kyle.hatlestad on December 06, 2009 at 11:11 PM CST #

I have a server template that does the file checkin but I want use it in the context of a Site Studio web site. Any trick to go about that?

Posted by Nathan on December 07, 2009 at 02:08 AM CST #

Nope, no special trick to it. You just need to add the element along with the proper metadata fields (dDocTitle, dDocType, etc) and IdcService (CHECKIN_NEW). I'd highly recommend getting a copy of Brian "Bex" Huff's book on The Definitive Guide to Stellent Content Server Development. He covers creating a custom check-in from into an HCST (which is basically like Site Studio's HCSP layouts, only with the alternate Idoc syntax) in Chapter 3.

Posted by kyle.hatlestad on December 07, 2009 at 02:20 AM CST #

I designed my forms in the exact manner as you, except I use the Ephox Editor that comes shipped with 10gR3 (build Unfortunately with Ephox, the WYSIWYG editor automatically puts in the <form> HTML tags anytime you insert a form field, so I cannot achieve what you've done in step 4. From the looks of it, you are using the FCKeditor. If so, how did you get the WYSIWYG element to load using the FCKeditor instead of Ephox? Thanks!

Posted by Andrew on January 27, 2010 at 01:36 AM CST #

Hey Andrew If Ephox is adding that in there, then you're going to need to pull the form tags out of the Region Template and then get your form object dynamically in JavaScript. I can't remember if users can add the name and/or ID for the form object in Ephox. But if so, you can reference it that way. Otherwise, you can loop through the form objects on the page and try and pick it up that way. That would then become the aForm in the code and the rest of the code should apply.

Posted by kyle.hatlestad on January 27, 2010 at 02:13 AM CST #

Yes, Ephox does allow you to provide the ID/name of the form and I've already done exactly what you've suggested. Everything works perfectly, but it would be nice to be able to limit the WYSIWYG from adding multiple forms. Your method guarantees a single form. The only way I was able to do so was by adding validation scripting. But this method only prevents them from saving multiple forms, not adding multiple forms. Also, the way Ephox handles cut and pasting isn't elegant either since it maintains the <form> tag whenever you copy a form field. If I could get rid of the <form> tag altogether, as you did, then everything would work perfectly.

Posted by Andrew on January 27, 2010 at 03:05 AM CST #

Why doesn't IsXml=1 work on DocInfo and other pages? IsJson, IsJava, IsSoap all appear to work. I am having an issue where I would like to return the content type of an xml document via its header request on IIS as text/xml but instead the request is being returned as text/html? If I use IsSoap I can see the content type is text/xml any ideas. As I can only do my javascript requests with IsJson but there is a required to use xml structured data. Thanks

Posted by John Sim on May 14, 2010 at 11:50 PM CDT #

Hey John, Yes, IsXml=1 is only designed to work on HCSP HTML forms because the form data stored within them is in XML format. And that is what is returned with that parameter. But all of the other dynamic pages in UCM don't support the IsXml=1 parameter. Maybe I'm misunderstanding, but why doesn't the IsSoap parameter work in your use case? It returns the service data in XML format and like you said, it's content type is text/xml. If you want the XML in a different structure then IsSoap, you'll need to write a component which has the services and templates you'll need. For the templates, you can design them to be in the XML format you need and you can set the content type for the header with the Idoc Script function of <$setHttpHeader("Content-Type", "text/xml")$>. Hope that helps. Thanks, Kyle

Posted by kyle.hatlestad on May 17, 2010 at 12:29 AM CDT #

Hi Kyle I was able to get this working but when i submit the form i get prompted for a login crentials. When using from a portal we dot want users to be prompted for login, is there a way to pass the credentials when calling SUBMIT_HTML_FORM? Thanks John

Posted by John on July 22, 2010 at 11:44 AM CDT #

Hey John, Unfortunately, the credentials needs to be passed via the browser session, thus the login challenge. One solution is to implement an SSO solution like Oracle Access Manager so both portal and UCM share the same authentication. Another option is a sample component I have called the GuestFormSubmit component. This allows users to submit HCSF forms without the need to login. A third option would be to implement the form as a portlet and use the RIDC API's into UCM to do the submission. The RIDC is a trusted connection to UCM so the user would not be challenged. Hopefully one of those approaches can work for you. Thanks, Kyle

Posted by kyle.hatlestad on July 22, 2010 at 11:13 PM CDT #

hello, i've tried your sample but i get this error all the time: "This content is unavailable (Dynamic Conversion failed)". thank you for any advice!

Posted by a. on September 06, 2010 at 01:53 AM CDT #

It sounds like the data file that is being associated with the placeholder does not have the xWebsiteObjectType properly defined as a 'Data File'. That would indicate it's trying to convert the document instead using Dynamic Converter (thus the error you're seeing).

Posted by kyle.hatlestad on September 07, 2010 at 07:53 AM CDT #

it was my mistake.. :) 10x.

Posted by a. on September 09, 2010 at 07:11 PM CDT #

Hi, Can i have this form integrated with an UCM workflow? I need to have the data collected in the form be verified by a workflow, with 1 step. Any pointers on the same. Regards, Abhilash

Posted by Abhilash on March 22, 2011 at 09:32 PM CDT #

Hello Abhilash, Yes, absolutely. The form that is submitted is a content item itself. So if you set up a criteria workflow to capture forms submitted via a specific metadata value, they can go through workflow. Thanks, -Kyle

Posted by kyle.hatlestad on March 23, 2011 at 12:07 AM CDT #

Hi Kyle, I'm trying to figure out a way to store the form data in the database instead of just xml data. Basically I want to be able to query the stored values and be able to report off of them with BO or Crystal. Any ideas would be greatly appreciated.

Posted by Tony on July 15, 2011 at 06:37 AM CDT #

Hey Tony,

To submit the form data to a database, you'll need a component that defines the query to do the insertion of data into your own table. I've got a sample component and form that shows how this is done. It is available at


Posted by Kyle Hatlestad on July 19, 2011 at 02:24 AM CDT #

Thanks so much for the response. I am unable to reach the link that you posted, the page is timing out. Do you have the example posted somewhere else?


Posted by Tony on July 20, 2011 at 03:49 AM CDT #

I was able to get in now, thanks

Posted by Tony on July 20, 2011 at 05:03 AM CDT #

After a form is submitted I need to create a flattened PDF of that form and store it along with the HCSP (preferably as the webviewable). Any suggestions?

Posted by DBJ on July 25, 2011 at 09:26 AM CDT #

Hi Kyle
Any suggestions on how to change this to work for a muti-step UCM form so the values entered in each page (step) are saved and submitted when user hits the submit button?

Posted by John on August 19, 2011 at 06:49 AM CDT #

Hi Kyle
Any suggestions on how to change this to work for a muti-step UCM form so the values entered in each page (step) are saved and submitted when user hits the submit button?

Posted by John on August 19, 2011 at 06:53 AM CDT #

Hey John,

It certainly is possible to create a multi-page form. But it would take quite a bit of extra logic. More then I could described here. Basically, each page of the form would actually do the submission. Then on the display of the form itself, you would load the information from the existing form and look at what information has been submitted so far. That would then determine the logic on what "page" of the form to show. Then when they get to the last page and submit, that would be the final submittal of the form.


Posted by Kyle Hatlestad on August 26, 2011 at 06:34 AM CDT #

hi Kyle

I have one question regarding site studio WYSIWYG element. Can i have any button in my contribution region that gives me calender there in contribution region, as i don't want the person to manually write date in contribution region. Is there any way to add some fixed HTML code in WYSIWYG component from site studio designer that is always part of this contribution.

Posted by guest on October 13, 2011 at 09:29 PM CDT #

You can modify the WYSIWYG editor using custom configuration scripts. Site Studio ships with a few samples that show you how to modify them. You could create one that gives you a calendar widget to pick from and place the date into the element. Here is the documentation on creating them:


Posted by Kyle Hatlestad on October 14, 2011 at 04:47 AM CDT #

hi Kyle

Thanks for your help. Can you please tell me how to get href from url_link_form_wizard.

Posted by guest on October 16, 2011 at 06:53 PM CDT #

What I like to do is use Firefox and Firebug. It lets you see URLs you may be accessing in pop-ups or through AJAX. In the case of the link form wizard, this is the href - /cs/resources/wcm/sitestudio/linkwizard/linkwizard.htm


Posted by Kyle Hatlestad on October 17, 2011 at 07:28 AM CDT #

Thanks Kyle,

I got my solutions regarding above two questions by your replies .
One more thing i wants two know.

I wanna implement a picture gallery using dynamic list.
Following is my folder structure on UCM.

-> CollegesGallery (images related to colleges are placed here)
-> CentersGallery (images related to centers are placed here)
-> AdministrationGallery (images related to administration are placed here)
and so on

Now i want to create a dynamic list that when placed in home page brings all images that are in folder uniGallery.
Similarly when i place it in colleges page it brings all images from uniGallery/collegesGallery .

The thing i want to know is can i change the search query String of same dynamic list if it is placed on different pages.
If not then what should be the better alternative to implement such picture gallery.

Your help is really appreciable.

Thanks Sadia

Posted by guest on October 19, 2011 at 12:29 AM CDT #

Hi Kyle,

I want to have some jsp code inside the wysiwyg because contributors, in my case, want to paste some html and they are using jstl for their tests on variables to display one html piece or another (it should be done on the template, but that's not how the client want's it). obviously, we can restrain that those variables are accessible from the data file, for example, we can add the to the metadata of the template.
I think that when the ssxa template servlet is computing it's response, that's when it makes a call to ucm to get the data file and merge it with the rest of the output. It's probably too late to have jsp there. I looked at Idoc, it's very interesting, but I don't know at what extent I can use it. If it's not possible to use jstl, then how we access templates's metadata values from the data file.
Thank you very much in advance for your help.


Posted by guest on November 27, 2011 at 01:42 PM CST #

Hey somebeach,

No, I don't believe you can do that. That sort of logic has to stay within the region/page templates. Perhaps you could add extra elements in the contribution form that help drive that logic in the template. So that the contributor has some control, but isn't putting in the code themselves.


Posted by guest on November 30, 2011 at 09:02 AM CST #

Hi Kyle,

Thank you very much for the answer.

The problem is that we have thousands of completely diffrent pages (the template has only a wysiwyg) where the same content will be pasted and for example phrases will be diffrent depending on some data.

Is there any way for the datafile to have access to template's data, because I was thinking of overriding/creating a tag based on <wcm:dataFile> to pass along the parameters I need to test on using idoc scripting inside the dataFile?
Currently, if I try to get the $nodeId from the dataFile, it's not possible.

Thanks again for your help


Posted by guest on December 03, 2011 at 03:40 PM CST #

Hi Kyle
Is it possible to convert the submitted UCM form data (hcsp file) to a pdf format during checkin. Can IBR PDF convertor be confiured to do this? Looking at options to provide used with a printable version of submitted UCM Web form.


Posted by John on May 04, 2012 at 05:17 PM CDT #

Hi Kyle,

Followed your example which works fine. Form is submitted to the cms. Issue is with RedirectURL and a simple criteria workflow
I include RedirectURL i the region template and set it to a confirmation page. I fill out the form and submit it. The confirmation page displays and the cms sends an email saying something new has been checked in.
I click on the link in the email, login to the cms, get the workflow menu on the left side and the content area is the confirmation page.
If I look at the native file ( . hcsp ) there's nothing in there with a redirect.
Google dev tools shows the .hcsp doing a 303 redirect to the confirmation page.

Any ideas ? This is on UCM.

Thank you

Posted by guest on June 22, 2012 at 02:31 PM CDT #

Hi!I need some help in creating a feedback form and then emailing the content with wfNotifiy to a group of users.The problem is that I can't execute wfNotify because the form is not in a workflow.I tried to change a metadata field hoping that it will enter the page in workflow execution but it failed.I don't know how to do this and it seems that I can't create a HCSF file like in the example above.Thanks!

Posted by guest_2013 on March 06, 2013 at 02:10 PM CST #

The resulting HCSP content that is generated from the submitted form should be able to enter workflow. You should do some tests by manually checking in a file with the same metadata as the generated HCSP and determine why the criteria workflow is not triggered. Once that is resolved, the notifications should happen as they normally would.


Posted by Kyle Hatlestad on March 06, 2013 at 03:45 PM CST #

Thank you for your reply!The problem is that i call a service that checks-in the form, which can be viewed from Site Studio Admin, but the metadata field it's empty.If I make an element definition and change manually the field to true, then the users receive a notification.It's a simple feedback submit form.Somehow I need to change the field when the user submits the form, but I don't know how to achieve this.Thanks!

Posted by guest on March 07, 2013 at 02:18 AM CST #

Post a Comment:
  • HTML Syntax: NOT allowed

Kyle Hatlestad is a Solution Architect in the WebCenter Architecture group (A-Team) who works with WebCenter Content and other products in the WebCenter & Fusion Middleware portfolios. The WebCenter A-Team blog can be found at: ateam_webcenter/


« July 2016