Fórum

Problem with Liferay.Autofield Component

Henal Saraiya, modificado 12 Anos atrás.

Problem with Liferay.Autofield Component

New Member Postagens: 18 Data de Entrada: 13/07/11 Postagens Recentes
I have used Liferay.Autofield component for adding multiple request on the JSP.

- When I try to add new row or I try to delete existing row at that time System gives me a java script error ("setting" is null or not an object).
- When I click on delete icon when I have only one row then it adds one more row.

Note : I have following controls on the JSP
i) DatePicker
ii) Dropdown
iii)Textbox

Test Environment:
> liferay-portal-5.2-ee-sp3
> Browsers : IE6 and IE7 and on both the browser I encountered same behavior.

Here is my code:
<fieldset class="block-labels rows-container" id="<portlet:namespace/>webFields" style="padding:0; border:1px solid #CCCCCC; border-top:0 none;border-bottom:0 none;">
<div class="lfr-form-row" id="testFieldset1" style="padding:0; border:0 none; margin-bottom:0;">
<div class="ctrl-holder">
<table cellspacing="0" cellpadding="0" border="0" style="border-bottom: 0pt none;" class="autofields-table">
<tbody>
<tr class="date-row">
<td class="colm-1 from-date-td" style="width:100px"">
<input class="date-pick from-date" readonly="readonly" id="<portlet:namespace/>fromDate1" type="text"
size="10" name="<portlet:namespace/>fromDate1" value=""
onmouseover="rebindDatepicker()">
</td>
<td class="colm-1 to-date-td" style="width:109px;">
<input class="date-pick to-date" readonly="readonly" id="<portlet:namespace/>toDate1" type="text"
size="10" name="<portlet:namespace/>toDate1" value=""
onmouseover="rebindDatepicker()">
</td>
<td class="colm-2 timeofftype-td" style="width:100px">
<span class="form-item">
<select class="leave-type-drop-down" name="<portlet:namespace/>dropdown1"
id="<portlet:namespace/>dropdown1">
<option value="<c:out value="${id}" />" ><c:out value="${value}" />
</option>
</select>
</span>
</td>
<td class="colm-2" style="width:70px">
<input type="text" class="text1" id="<portlet:namespace/>text1" name="<portlet:namespace/>text1" value="" size="4" ></input>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</fieldset>

jQuery(
function () {
new Liferay.AutoFields(
{
container: '#<portlet:namespace />webFields',
baseRows: '#<portlet:namespace />webFields > .lfr-form-row',
fieldIndexes: '<portlet:namespace />formFieldsIndexes'

}
);
}
);

function rebindDatepicker(){
jQuery('.date-pick').removeClass('hasDatepicker').datepicker({
dateFormat: 'mm-dd-yy'
});
}


This is very urgent if any one has encountered same problem or knows the solution please reply.
Henal Saraiya, modificado 12 Anos atrás.

RE: Problem with Liferay.Autofield Component

New Member Postagens: 18 Data de Entrada: 13/07/11 Postagens Recentes
Hello EveryOne,

To add to my post I have observed that this problem comes up in the case when I try to rebind the datepicker class to the input control. This is the code that I have used to bind the datepicker control...

function rebindDatepicker(){
jQuery('.date-pick').removeClass('hasDatepicker').datepicker({
dateFormat: 'mm-dd-yy'
});

and I call above function on the onblur event of input control. So this is the code from where I call the above function.

<input type="text" size="10" name="fromDate1" value="" onmouseover="rebindDatepicker()">

So error which I mentioned in my post i.e. "When I try to add new row or I try to delete existing row at that time System gives me a java script error ("setting" is null or not an object)." gets resolved if I remove datepicker code in IE. but the same code works okay in Firefox browser with the dynamic binding of date picker code.

Regards,
Henal Saraiya
Henal Saraiya, modificado 12 Anos atrás.

RE: Problem with Liferay.Autofield Component

New Member Postagens: 18 Data de Entrada: 13/07/11 Postagens Recentes
Hey Guys,

I have Re-design the implementation logic to solve the problem. And in new implementation my problem got resolved. emoticon

Thanks and Regards,
Henal Saraiya
Umasankar Jeyaraj, modificado 10 Anos atrás.

RE: Problem with Liferay.Autofield Component

New Member Postagens: 7 Data de Entrada: 16/07/13 Postagens Recentes
Hi Henal,
Could you please share the code. I have the same requirement