Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Albert Devarajan
Custom field drop down box value
February 25, 2013 3:10 AM
Answer

Albert Devarajan

Rank: New Member

Posts: 21

Join Date: December 12, 2012

Recent Posts

I have developed a dropdown using custom field with some options such as A,B and C ..when I select B and save it, the value should be displayed as the selected one after i clicked the save button..How can i do that can anyone please help me??
Juhi Kumari
RE: Custom field drop down box value
February 25, 2013 3:32 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,

Set that value in request in your java class and again get that value from request in your jsp ans set as selected.

Regards
Juhi
Albert Devarajan
RE: Custom field drop down box value
February 25, 2013 4:16 AM
Answer

Albert Devarajan

Rank: New Member

Posts: 21

Join Date: December 12, 2012

Recent Posts

Hi juhi,
I followed your steps but I am not getting the result. My requirement is as below
I am having a drop down field as and when i m selecting another value it should be displayed after i clicked save button
Attachment

Attachments: li.PNG (11.0k)
Juhi Kumari
RE: Custom field drop down box value
February 25, 2013 4:56 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
For ex.
In jsp
1<select name="name">
2    <option value="value1">Value1</option>
3    <option value="value2">Value2</option>
4</select>


In processAction
1String val = request.getParamater("name");
2request.setAttribute("name",name);


again in diView
1request.setAttribute("name",request.getAttribute("name"));


and when come back to jsp
1
2<%
3  String name = (String)request.getAttribute("name");
4%>
5<select name="name">
6    <option value="value1" <%= (name.equalsIgnoreCase("value1")) ? "selected" : "" %>>Value1</option>
7    <option value="value2" <%= (name.equalsIgnoreCase("value2")) ? "selected" : "" %>>Value2</option>
8</select>


Try like this.

Regards
Juhi
Albert Devarajan
RE: Custom field drop down box value
February 25, 2013 11:05 PM
Answer

Albert Devarajan

Rank: New Member

Posts: 21

Join Date: December 12, 2012

Recent Posts

Thanks a lot juhi