Change action attribute of a form element at the server side.

Hi,

 

When we add a component with <form> element to a .page then when the page gets rendered we will see the form action getting set with path to the .page to which the component got added.

 

Ex: I have registration.component and when I add it to a registration.page and when I access registration.page then see below content in view page source

 

<form onsubmit="return submitAction()" name="form1" id="form1" action="/dynamic-store/reglogin/registration.page?submit=true&componentID=1395868004571" method="post">

 

I would like to change the action attribute of the form element to a friendly URL at the server side itself. How can I do that in Teamsite?

 

<form onsubmit="return submitAction()" name="form1" id="form1" action="/photo-gift/registration?submit=true&componentID=1395868004571" method="post">

 

Note: Currently we have written a javascript code which executes on page load and changes the form action to the friendly URL. This will work, but in some cases when javascirpt function is not getting executes for some reason then users are getting blank page as we do not allow to render a page with .page extension.

 

Thanks
Vinod Goud

 

 

Comments

  • In your XSL, add type="external" on your <form> tag. This tells the LiveSite engine to not rewrite the action attribute, and type="external" will be removed from the final output so as to not produce invalid markup.

  • Awesome. I will try it out. Thanks much rpoulin.

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs