PDA

View Full Version : Get hidden field value using extjs



nityajs
6 Aug 2009, 4:53 PM
Hi All,
I am trying to get the value from the hidden element in jsp in javascript like shown below,
but its not working.

Jsp page code :
---------------
<%
//converting to json data
String jsondata=
new JSONSerializer().exclude(exclude).serialize(categoryList);

//here the data prints fine
[{"id":"sss","wt":20},{"id":"mmm","wt":10},{"id":"ccc","wt":30}]
%>

//storing into hidden field to get in js file
<INPUT TYPE="hidden" id="test" NAME="test" value="<%=jsondata%>">

In Javascript:
----------------
var data=Ext.get('test').dom.value;
Here data is null.

Can any one let me know what is wrong with my code.

tubamanu
6 Aug 2009, 11:12 PM
i used the same hiddenfield like yours some days ago. for me it works. but i had no NAME attribute in..


<input type="hidden" id="symfony_id" value="<?php echo url_for('order/LoadList')?>" />

if it still doesnt work, maybe u can render an hidden ext component into a div or so^^