on 09-14-2006 6:31 AM
Hi all,
I generated dynamic inputfields on clicking of the button. Now after generating I want to get the value of dynamically generated input field and I want to store it in database also. If any one knows Plz tell me.
Thanks in advance.
Hi Krishnaveni,
For getting the value of this input field you have get the get teh value of the attribute which you must have binded with this inputfield.
I hope you must have binded some attribute to this input field. If not then do that. Since you are creating the inputfield dynamically so you have to the attribute binding also dynamically.
Use the following code:
1) Create a objet of a input field, say:
IWDInputField idk = ((IWDInputField)view.createElement(IWDInputField.class, "input");
2) Now use this object to bind the attribute to this field:
idk.bindValue(wdContext.getNodeInfo().getAttribute(input_Variable));
<i>(Where: <b>input_Variable</b>, is the attribute in the context node)</i>
Now for getting the value of this input field use this code:
String value = wdContext.currentContextElement().getAttributeValue(input_Variable).toString();
This value is the value of the synamically generated inputfield
I hope this helps you.
Regards
Pravesh
PS: Please consider rewarding points if helpful and solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
With help of all your answers I solved the problem. thanks for all your inputs. By the way i rewarded points to all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1)Create context for the inputfield dynamically in init method.
IWDAttributeInfo a=wdContext.getNodeInfo().addAttribute("val1","ddic:com.sap.String");
2)Create the inputfield andd bind to this context
IWDInputField ip=(IWDInputField)view.createElement(IWDInputField.class,"input1");
ip.bindValue("val1");
3)Get the value from the inputfiels like this
String s=( String)wdContext.currentContextElement().getAttributeValue("val1");
Get the connection to the database and insert the value to it.
try{
InitialContext initialContext = new InitialContext();
DataSource dataSource = (DataSource)initialContext.lookup("AlaisName");
java.sql.Connection conn = dataSource.getConnection();
//Do Others
}catch(Exception e){
e.printStackTrace();
}
Regards,
Vijayakhanna Raman
Message was edited by: Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can get the values from the same screen which is dynamically created.
IWDNode node1 =wdContext.node<Dynamicnode>().getChildNode("<NodeName>");
String values ="";
if(node1.getCurrentElement().getAttributeValue("<Name>")!=null){
values=(String) node1.getCurrentElement().getAttributeValue("<Name>");
}else{
values = "";
}
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
use the followig Steps for only Retreving the data from dynamic input field.
IWDNode node =wdContext.currentContextElement().node().getChildNode(<Node Name>,0);
IWDNodeElement nodeElement = node.getCurrentElement();
Object <ans> =nodeElement.getAttributeValue(String.valueOf(<Node Name>);
finally you will get the inputFiled data in the
<ans> variable.
Regards
Dhinakar
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.