Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struts Problem

Status
Not open for further replies.

DB2Problem

Programmer
Oct 17, 2002
53
US
Hello ALL {STRUTS GURUS}

I have this struts driven JSP page that has a checkbox - Named as "Unsubscribe" having value of on/off depending on property = checkbox. When you check the box I call a javascript function go(). I need to implement this function "or" if you have a better Idea you can suggest me {otherwise}

So when i click on this checkbox, i need to disable the other multiboxes on the same JSP page {again - same JSP page, The reason is that if someone clicks on "Unsubscribe" he/she should see the other checkboxes as disabled.

For this usecase, I just want the end user NOT TO do any activity once they click on "Unsubscribe". The only option they will have is to submit the page. That will take them to so called thankyou page.

Now, I have to find the best solution that avoids a trip to another action {ActionServlet} and optimize the code as well.

How can I achieve this goal??

Below is my full JSP page and I have left the javascript function just with an alert. If anyone of you have encountered this problem, please share the knowledge else advise advise advise

Thanks a lot

JSP page is given below -

<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:html locale="true">
<head>
<html:base/>
<title><bean:message key="title.homepage.pccenter"/></title>

<script language="javascript" src="js/global.js"></script>
<script language="javascript" src="js/msrp.js"></script>
<script language="javascript" src="js/util.js"></script>
<script language="javascript">
var navOn = 1;
// currently unused: var currentParent = "";
var currentPage = "homepage";
var curSubPage = "home";
var parent_list = "";
var curVehicle = "brand";
var curModel = "";
var homepageName = "flash";
</script>

<script language="javascript" src="js/nav.js"></script>
<script language="javascript" src="nav/home_nav.js"></script>

<link rel="stylesheet" type="text/css" href="css/base_font.css"></link>
<link rel="stylesheet" type="text/css" href="css/pref_center.css"></link>
<link rel="stylesheet" type="text/css" href="css/buttons.css"></link>
<style type="text/css">
.footer{
margin-top:1;
}
</style>
</head>
<script>
function go() {
alert("hello");
}
</script>

<body bgcolor="#FFFFFF" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">

<html:form action="/subscription">
<!-- start page guts -->

<!-- ++++++++++++++++++ -->

<!-- ++++++++++++++++++ -->

<div class="pageTitle"><img src="img/subsc_ctr.gif" alt="Subscription Center"></div>

<table class="prefHolder" border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="leftHandCell width50">

<div class="bottomPad"><bean:message key="message.top.text" /></div>





<div class="blueBox padSmall"><bean:message key="message.top.emailText" />



<div class="pageSubTitle"><bean:write name="MainForm" property="consumerEmailAddress" /></div>

</div>

<div class="buttonLinks bottomPad"><a class="c_m o_med_button" href="#">ACCOUNT SETTINGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><div class="floatRight buttonLinksText">To change this, please go to&nbsp;&nbsp;</div></div>

<div class="pageSubTitle bottomPad"><bean:message key="message.middle.privacy" /></div>

<div><bean:message key="message.middle.privactStatement" /><br>

<bean:message key="message.middle.privacyLink" /></div>

</td>

<td class="rightHandCell width50">

<div class="blueBox">

<div class="padTen"><span class="pageSubTitle"><bean:message key="message.subscription.top.text" /></span><br><bean:message key="message.subscription.top.optionsText" /></div>

<!-- USE -->

<div class="hilightRow">

<table border="0" cellspacing="0" cellpadding="5">

<tr>

<td><html:checkbox property="checkbox" onclick="javascript:go(); return false;" /></td>

<td><strong><bean:message key="message.subscription.unsubscribe" /></strong><br><bean:message key="message.subscription.unsubscribeText" /></td>

</tr>

</table>

</div>


<logic:present name="MainForm">
<logic:iterate id="subscription" name="MainForm" property="subscriptionList" indexId="index">
<table border="0" cellspacing="0" cellpadding="5">

<tr>

<td><strong><html:multibox property="subscrIds">

<bean:write name="subscription" property="sbs_code" />
</html:multibox></strong><br><bean:write name="subscription" property="sbs_desc" /></html:multibox></td>

</tr>
</logic:iterate>
</logic:present>

</table>

</div>

<html:hidden property="pageName" value="home"/>

<html:submit value="Submit Request >"/>

</td>

</tr>

</table>
</html:form>
</body>
</html:html>



 
This is more of a Struts related question, which should probably be posted in that forum (you know where it is).

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Yes you are correct, but then I thought may be a javascript function will be an alternative solution as well. Anyhow, as per your suggestion, the same posting is now in struts
 
If its a Javascript solution you require, you could try the javascript forum aswell (you might want to remove the struts bits, and post pure html as it might confuse them :p )

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top