TS741, Win Sewr 2008
-------------------------
I have a preview.jsp page , which makes a call top itself when a language is changed, which in turns calls JavaScript code dualPreview.js. When language is changed fro English to Spanish, call is made to preview.js.
When code finishes dualPtreview.js and comes back to JSP, page breaks and spreads out. It becomes normal, when I click on "Go" button. WHen I change language from Spanish to English, page does not break and stays normal. Can someone please give an idea, what can this be due to ?
code for preview.jsp
...............<li class="copy-sub" title="Determines which language to preview with">
<label>Language</label>
<select onchange="languageChange(this);" id="locale" class="preview-controls-themetype">
<option value="en">English</option>
<option value="fr">Spanish</option>
</select>
<script>alert('Select finish and Form to be entered');</script>
<form method="post" id="duaLPreviewForm" action="/iw-cc/previewpath">
<script>alert('Form entered');</script>
<input type="submit" class="button button-secondary button-compact" value="Go"/>
<input type="hidden" name="xslpath" id="xpath" value="<%=request.getParameter("xslpath")%>" />
<input type="hidden" name="vpath" id="path" value="<%=request.getParameter("vpath")%>" />
</form>
<script type="text/javascript" src="assets/js/dualPreview.js"></script>
</li>.................................
Code for dualPreview.js
alert('custom JS entered');
var xslName = document.getElementById("xpath").value;
alert('xslName set entered');
var dcrPath = document.getElementById("path").value;
alert('dcrPath entered');
var indexofCa = dcrPath.indexOf("_ca");
indexofCa = indexofCa -2 ;
var slicedDCRPath = dcrPath.slice(0,indexofCa);
var locale = dcrPath.substring(indexofCa,dcrPath.indexOf("_ca"));
document.getElementById("locale").value = locale;
alert('locale set');
function languageChange(selectObj)
{
alert('languageChange entered');
dcrPath = slicedDCRPath + selectObj.value +"_ca";
alert('dcrPath passed');
document.getElementById("path").value=dcrPath;
alert('value of Path variable set');
document.getElementById("xpath").value=xslName;
alert('value of xpath set');
}