rajyalakshmi.suman
Sep 13th, 2007, 08:04 AM
Hi,
Value in TextField should persist after button click.
After button click page gets refreshed & value is not persisting in textfiled
Have tried using form:tags ,spring:bind tags ...
If am using "Spring :bind ":value is persisting but results are not getting displayed after onclick :button .
Kindly let me know is it possible in spring+portletjsr168 ?
<h3>Search Entries</h3>
<%BDCompanyFilterCommand bdcomp1;
bdcomp1 =
(BDCompanyFilterCommand) renderRequest.getPortletSession().getAttribute("bd CompanyFilter");
if (bdcomp1 == null){
bdcomp1 = new BDCompanyFilterCommand();
}
String strFname=null;
String strBusinNr = null;
String strActive = null;
if (renderRequest.getPortletSession().getAttribute("F IRMENAME")!=null) {
strFname= (String)renderRequest.getPortletSession().getAttri bute("FIRMENAME");
}
if (renderRequest.getPortletSession().getAttribute("B U_NR")!=null) {
strBusinNr= renderRequest.getPortletSession().getAttribute("BU _NR").toString();
}
if (renderRequest.getPortletSession().getAttribute("A CTIVE")!=null ) {
strActive= renderRequest.getPortletSession().getAttribute("AC TIVE").toString();
System.out.println("ACTIVE"+strActive);
}
%>
<form:form action="<%=targetURL%>" commandName="bdCompanyFilter">
<input type="hidden" name="param" value="Search" />
<table border="0" cellpadding="4">
<tr>
<td class="wpsTableText">Company name</td>
<td class="wpsTableText">Business unit Nr.</td>
<td class="wpsTableText">Active</td>
</tr>
<tr>
<td> <form:input cssClass="wpsEditField" path="firmename" size="15" maxlength="10" /></td>
<td> <form:input cssClass="wpsEditField" path="bu_nr" size="15" maxlength="10" onkeypress="return checkNumberic(event);" /><%=strBusinNr%></td>
<!--<td> <input type="text" name="bu_nr" size="15" maxlength="10" onkeypress="return checkNumberic(event);" value="<%=strBusinNr%>" /></td>
<form:hidden path="bu_nr" />-->
<td> <input type="checkbox" name="chkActive" onclick="populateActive()" /></td>
<form:hidden path="active" />
</tr>
<tr>
<td colspan="2">
<button type="submit" class="wpsButtonText" onclick="populateActive()">Search</button>
</td>
</tr>
<script>
function checkNumberic (evt) {
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
if (charCode < 48 || charCode > 57) {
return false;
} else {
return true;
}
}
function populateActive()
{
if(document.forms[0].chkActive.checked)
document.forms[0].active.value=1;
else
document.forms[0].active.value=0;
}
function populateActiveCheckBox()
{
activeCheck="<%=strActive%>";
alert("ACTIVE Value:"+activeCheck);
if(activeCheck==1)
{
document.forms[0].active.checked=true;
}
else
{
document.forms[0].active.checked=false;
}
}
populateActiveCheckBox();
</script>
</table></fieldset>
</form:form>
Thank u
Lakshmi
Value in TextField should persist after button click.
After button click page gets refreshed & value is not persisting in textfiled
Have tried using form:tags ,spring:bind tags ...
If am using "Spring :bind ":value is persisting but results are not getting displayed after onclick :button .
Kindly let me know is it possible in spring+portletjsr168 ?
<h3>Search Entries</h3>
<%BDCompanyFilterCommand bdcomp1;
bdcomp1 =
(BDCompanyFilterCommand) renderRequest.getPortletSession().getAttribute("bd CompanyFilter");
if (bdcomp1 == null){
bdcomp1 = new BDCompanyFilterCommand();
}
String strFname=null;
String strBusinNr = null;
String strActive = null;
if (renderRequest.getPortletSession().getAttribute("F IRMENAME")!=null) {
strFname= (String)renderRequest.getPortletSession().getAttri bute("FIRMENAME");
}
if (renderRequest.getPortletSession().getAttribute("B U_NR")!=null) {
strBusinNr= renderRequest.getPortletSession().getAttribute("BU _NR").toString();
}
if (renderRequest.getPortletSession().getAttribute("A CTIVE")!=null ) {
strActive= renderRequest.getPortletSession().getAttribute("AC TIVE").toString();
System.out.println("ACTIVE"+strActive);
}
%>
<form:form action="<%=targetURL%>" commandName="bdCompanyFilter">
<input type="hidden" name="param" value="Search" />
<table border="0" cellpadding="4">
<tr>
<td class="wpsTableText">Company name</td>
<td class="wpsTableText">Business unit Nr.</td>
<td class="wpsTableText">Active</td>
</tr>
<tr>
<td> <form:input cssClass="wpsEditField" path="firmename" size="15" maxlength="10" /></td>
<td> <form:input cssClass="wpsEditField" path="bu_nr" size="15" maxlength="10" onkeypress="return checkNumberic(event);" /><%=strBusinNr%></td>
<!--<td> <input type="text" name="bu_nr" size="15" maxlength="10" onkeypress="return checkNumberic(event);" value="<%=strBusinNr%>" /></td>
<form:hidden path="bu_nr" />-->
<td> <input type="checkbox" name="chkActive" onclick="populateActive()" /></td>
<form:hidden path="active" />
</tr>
<tr>
<td colspan="2">
<button type="submit" class="wpsButtonText" onclick="populateActive()">Search</button>
</td>
</tr>
<script>
function checkNumberic (evt) {
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ? evt.which : evt.keyCode);
if (charCode < 48 || charCode > 57) {
return false;
} else {
return true;
}
}
function populateActive()
{
if(document.forms[0].chkActive.checked)
document.forms[0].active.value=1;
else
document.forms[0].active.value=0;
}
function populateActiveCheckBox()
{
activeCheck="<%=strActive%>";
alert("ACTIVE Value:"+activeCheck);
if(activeCheck==1)
{
document.forms[0].active.checked=true;
}
else
{
document.forms[0].active.checked=false;
}
}
populateActiveCheckBox();
</script>
</table></fieldset>
</form:form>
Thank u
Lakshmi