February 18, 2008, 12:13 PM
Dan PinaultHTML Layout Page Javascript Works in IE but not in Firefox
Hi,
I've created a report launch page in HTML Layout Painter that includes some javascript that works in IE but not in Firefox. Here is the scenario...
The page has a series of radio buttons for the user to select which report they want to run. I created the radio button array (which is really a set of checkboxes in the html code created by the HTML Layout Painter) and they have IDs of viewselect_0, viewselect_1, ... viewselect_6.
I edited the hyperlink properties of the Submit button to include a request for each of the reports available. The requests have IDs from 1 through 7
Here is the section of code in question...
//Begin function SubmitBtn_OnClick
function SubmitBtn_OnClick(ctrl) {
// TODO: Add your event handler code here
if (viewselect_0.checked) {SubmitBtn.requests_list = "1"} else
if (viewselect_1.checked) {SubmitBtn.requests_list = "2"} else
if (viewselect_2.checked) {SubmitBtn.requests_list = "3"} else
if (viewselect_3.checked) {SubmitBtn.requests_list = "4"} else
if (viewselect_4.checked) {SubmitBtn.requests_list = "5"} else
if (viewselect_5.checked) {SubmitBtn.requests_list = "6"} else
if (viewselect_6.checked) {SubmitBtn.requests_list = "7"} else
{SubmitBtn.requests_list = "0"}
OnExecute(ctrl)
}
//End function SubmitBtn_OnClick
This works OK in IE but in Firefox all the requests are executed. How can I reform this code so it works in Firefox as well as IE?
Thanks!
Dan
February 18, 2008, 01:18 PM
Alan BThe correct syntax in js to see if a radio button is checked would be
if (document.getElementById("viewselect_0").checked == 'true') {
.
.
}
IE is more lenient in the syntax it will run, Firefox is more correct.
February 18, 2008, 03:04 PM
Dan PinaultAlan,
Thanks for the tip. After playing around with it this is what I ended up with that would work in both browsers...
//Begin function SubmitBtn_OnClick
function SubmitBtn_OnClick(ctrl) {
// TODO: Add your event handler code here
if (document.getElementById("viewselect_0").checked == true) {SubmitBtn.setAttribute("requests_list","1")} else
if (document.getElementById("viewselect_1").checked == true) {SubmitBtn.setAttribute("requests_list","2")} else
if (document.getElementById("viewselect_2").checked == true) {SubmitBtn.setAttribute("requests_list","3")} else
if (document.getElementById("viewselect_3").checked == true) {SubmitBtn.setAttribute("requests_list","4")} else
if (document.getElementById("viewselect_4").checked == true) {SubmitBtn.setAttribute("requests_list","5")} else
if (document.getElementById("viewselect_5").checked == true) {SubmitBtn.setAttribute("requests_list","6")} else
if (document.getElementById("viewselect_6").checked == true) {SubmitBtn.setAttribute("requests_list","7")} else
{SubmitBtn.setAttribute("requests_list","0")}
OnExecute(ctrl)
}
//End function SubmitBtn_OnClick