Accessing dynamically created fields
Hi,
I have a html that has an input field on it. Say we enter a number( e.g. 5) and submit the html.
The html transfers control to 1. jsp which creates input fields based on the number entered. In the above example 5 input(text) fields are created dynamically.
Once I submit 1.jsp, it transfers control to another 2.jsp.
In 2.jsp, I need to access the values entered in the 5 fields on 1.jsp.
request.getparameter() returns value only from the 1st field (out of the 5 fields). How to access the remaining fields ?
Any help is really appreciated.
Thanks,
Thanks a lot. That worked!!!!
Even the ordering seem to be ok.
With your other suggestion, I had tried that before but that did not work.
I created field names as field1,field2..etc on the fly and stored this in a String variable - fileName.
<% fileName = fileName concatinated with number %>
<input type = "text" name=fileName > Note: There are no quotes around fileName. So fileName could be fileName1, fileName2 etc
(I don't think the quotes around name attribute really matters.)
When I say request.getparameter("fileName") it returned only the 1st fileName. Let me know what youythink.
Thanks again.
Similar Messages
-
Accessing Dynamically created Button
Hi,
Can someone give me an example how to access dynamically created button?
I know how to create a button dynamically but don't know how to access from AS3.
Thanks!Hi,
Please go through following links.
1) http://www.daveoncode.com/2009/05/20/objectcollector-accessing-dynamic-generated-flex-obje cts-by-id/
2) http://stackoverflow.com/questions/6740813/flex-assigning-events-to-dynamically-created-bu ttons
3) http://www.justskins.com/forums/adding-click-event-to-35785.html
Thanks and Regards,
Vibhuti Gosavi | [email protected] | www.infocepts.com -
Access dynamically created JTextField
i need to create an unknown number of JTextField in my GUI, and this number depends on a user-input value.
Subsequently, i will need to read the strings from the JTextField. This is how I dynamically created my JTextField:
while (i < num-1) {
rangePanel.add(new JTextField("0")); // 0 is merely a default value
how can i access the created JTextFields?
thanxIs this the preferred style?
I currently have an array of JTextFields but am having real grief (input on screen not availble fro getText(), etc.), code fragment:
JTextField [] tf = new JTextField[10];
for (i=0, i<10; i++) {
ft[i] = new JTextField(15);
user enters data on screen...
String str = tf[0].getText() returns blank. Also <tab>ing jumps between first position and where ever mouse originally landed in field. -
Need help populating dynamically-created fields
I have a form which uses Javascript to create table rows on
the fly so as to add items to a list dynamically. The table
consists of two fields -- an ID and let's call the other one
Attribute A. The user clicks "Add another one" and another row of
data entry fields pops up. My action page works fine to get the
value of these rows using the evaluate() function (I always
wondered what that did), but I want it to go back to the calling
page, have the calling page create the correct number of rows, and
populate them with the changed or inserted data that was just saved
-- the same way that an ordinary action page might save data and
then return you to the calling page.
The first row of this table is created through HTML and only
additional rows are created dynamically.
I have it all working up to and including the creation of the
correct number of fields as an "onload=(loadTheData)" in the
<body> tag, but how the heck and where do I populate them
with the data returned from the query?
Below is the Javascript and how it's called. I changed some
variable names to protect the innocent, but that's basically how it
works. So the Javascript is creating the fields -- one for each
record returned by the query -- but how can I assign the record
values in turn? Do I need WDDX? If so, how would that be
written?If you are going to use JavaScript to dynamically create the
list, then
look into the <cfwddx...> tag that is very useful for
translating
ColdFusion data structures into JavaScript data structures.
You can
then use the JavaScript data to populate your table.
But I would think it would be simplier to use the ColdFusion
data to
build the default table with existing data. Instead of just
creating
one row with ColdFusion create rows for the existing data
then just use
the JavaScript to add more rows on the client, just as you
are doing now.
P.S. evaluate() is usually an awkward choice to access
dynamical form
variables. I presume you are using something like
<cfset something = evaluate("form.aField_#aVar#")>
This can be easier with the use of array notation.
<cfset something = form['aField_' & aVar]>
OR
<cfset something = form['aField_#aVar#']>
To each his own, but knowing array notation is a very
powerful technique. -
Accessing dynamically created movieclips
I have an application that I am adding movieclips to a
container movieclip through a for loop and repeatedly calling
myClip.addChild(theNewClip). Now I have a dozen clips in my
container and it seems like the only way to access the clip is to
use the getChildByName() method and cast it into a temporary clip
so I can get at the its properties.
Is this the best and/or only way to do this? Does the old AS2
myContainer["theName"].property not work with dynamically created
movieclips? It doesn't seem to work for me anymore.
Anyway I am getting the clips now, but I was hoping someone
could show me a better way to access a dynamically created movie
clip.In AS3, this is probably not much better, but you can
generically loop through all movie clips: -
Setfocus to dynamic created field
Hello
In a field validation for a dynamic created table row the focus should be set to the same field again, if the field entry is invalid.
I tried the following two versions for the field 'MyNumber' in the first row without success:
>javascript:
>1) xfa.host.setFocus("MySubform.Table1.DataRow.all.item(0).MyNumber");
>2) xfa.host.setFocus("MySubform.Table1.DataRow[0].MyNumber");
Thank you for any hint.
Sincerely
LoreHello SekharN
Yes, this is exactly what I wanted to do. But the focus wasn't set back to the wrong-entry-field. No focus was set at all :(
I used the exit event was this wrong?
Here my code:
if(!XCode.isNull && XCode.rawValue != '') {
var s = XCode.rawValue;
var tridigits = new RegExp('^\\d{3}');
if (tridigits.test(s) == false){
xfa.host.messageBox( "Please 3 digits!" );
xfa.host.setFocus(this.somExpression);
Thank you
Sincerely
Lore -
Accessing Dynamically created Context
Hi,
I want to actually read the context which is dynamically created. I have a basic doubt that, will that context contain all the records or just metadata in context? How to read certain records from the context. I dont want to populate them to view via some textbox etc, actually using that data I want to create some xml. so I need to read all the records which are available in that context.
Please let me know your inputs asap.
Best REgards,
RiteshHi Mehta,
You can create both nodes as well as attributes in context dynamically. If you are creating a context attribute it will have only a single value.If you are creating context nodes it will have multiple values
IWDNode node = wdContext.getChildNode("<node name>",IWDNode.LEAD_SELECTION);
IWDTextview text = (IWDTextview)view,createElement(IWDTextview.class,null)
text.bindText(node.getElementAt(<give index>).getAttribute())
Hope this helps you
Try to create context attributes and nodes statically
Hope this helps you
Regards
Rohit -
Accessing dynamically created objects
If objects are created dynamically in AS3, using code like
this:
for (var num:Number = 0; num<10; num++){
var txtFld:TextField = new TextField();
txtFld.text = 'This is the original text';
this.addChild(txtFld);
then later, i want to changet the text of one of the
TextFields, how can I do that? The only instance listed in the
variables is a single instance of "txtFld" and it is the last one
that is created. How can I access the others?
ThanksTwo ways pop to my mind.
Give them a name property when you create them and then use
getChildByName().
Push each instance into an array/vector as you create it and
then iterate over the values in the array.
A combination of both? -
Problem with accessing dynamically created movie clips, returns null...
Hopefully this is a stupid question with an easy answer, if my code is straight forward enough.
I am using this snippet of code to create menu items, and then use the jCount variable below to give the clips an index number, like so (which seems to be working just fine):
for(var j:Number=0;j<xmlSubMenuLength;j++){
var mcSubMenuItem:mcSubMenu=new mcSubMenu();
addChild(mcSubMenuItem);
jCount++;
mcSubMenuItem.name = "mcSubMenuItem" + jCount;
//traces out names correctly
trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
mcSubMenuItem.x=mcMenuHolder.x+20;
mcSubMenuItem.y =mcMenuHolder.y;
mcSubMenuItem.y+= nextBtnY;
nextBtnY+=subtopicSpace;
global_subi.text = String(jCount); //i see the proper count of 10 in the text field
However, when I try to access the clips using this snippet:
for(var j:Number=0;j<Number(global_subi.text);j++)//
trace("GLOBAL SUBI = "+ String(global_subi.text)); //traces out 10, which it should
var scSubMenuItem:String = "mcSubMenuItem" + j;
var scSubContent:Object = this.getChildByName(scSubMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent); //returns null!
My last trace statement returns null. Can anyone see my error, or explain why I can't access my clips after they have been created?
Thank you muchly,
~ChiplehHi kglad,
Thanks for the response.
"it's not clear from the shown code that jCount is initialized." - I've posted the relevant code below, which shows that I'm initializing jCount.
"and it's not clear why you don't use j instead of jCount in that for-loop" - j is used as loop for creating the subtopic movie clips within the i for-loop. So, for each topic in i for-loop, create a group of suptopics using the j for-loop. The j for-loop re-initiates j every time the length of the subtopics is reached(if that makes any sense) - i.e. topic1>subtopic 1,2,3,4 : topic2>subtopic>1,2 : topic3>subtopic1,2,3,4
jCount is used to keep a running count of the total number of subtopcs created - i.e. per the example above, jCount will display 10.
var topicSpace:uint=button_mc.height;
var subtopicSpace:uint = button_mc.height;
var nextBtnY:uint = 0;//whatever;
var jCount:Number = 0;
function createXMLMenu(menuLength:Number,itemName:XMLList):void{
var navItemText:XMLList = itemName;
for(var i:Number=0;i<menuLength;i++)
var mcMenuItem:mcMenu=new mcMenu();
addChild(mcMenuItem);
mcMenuItem.btnTxt.htmlText = i+1 +". " +navItemText[i];
mcMenuItem.ivar = i;
mcMenuItem.name = "mcMenuItem" + i;
mcMenuItem.x=mcMenuHolder.x;
mcMenuItem.y =mcMenuHolder.y;
//kglad's addition
mcMenuItem.y+= nextBtnY;
nextBtnY+=topicSpace;
var subVar:Number = i;//mcMenuItem.ivar
//Submenu content
var xmlSubMenuLength:Number = xml.sim.bodyText.page[i].subpage.length()
var menuItemAttachment:MovieClip = MovieClip(mcMenuItem);
for(var j:Number=0;j<xmlSubMenuLength;j++)
var xmlSubPageNumber:XMLList = xml.sim.bodyText.page[subVar].subpage;
var subNavLinkNumber:Number = xmlSubPageNumber[j];
var subTitleText:String = xml.sim.bodyText.page[subVar].subpage.subNavItem[j];
var mcSubMenuItem:mcSubMenu=new mcSubMenu();
trace("mcSubMenuItem.ivar = "+ j+1);
var mc2Attach2:MovieClip = MovieClip(menuItemAttachment);
mcSubMenuItem.btnTxt.htmlText = j+1 +". " +subTitleText;
mcSubMenuItem.ivar = Number(subVar);
mcSubMenuItem.jvar = Number(j);
addChild(mcSubMenuItem);
jCount++;
mcSubMenuItem.name = "mcSubMenuItem" + jCount;
trace ("---------------------------------jCount NAME = "+ mcSubMenuItem.name);
mcSubMenuItem.x=mcMenuHolder.x+20;
mcSubMenuItem.y =mcMenuHolder.y;
//kglad's addition
mcSubMenuItem.y+= nextBtnY;
nextBtnY+=subtopicSpace;
global_subi.text = String(jCount);
mcSubMenuItem.lExtend.visible = false;
global_i.text = String(i);
Then I try to access the clips like so:
-The first for-loop access the topic movie clips, no problem, and traces out scContent correctly.
-The second for-loop traces out null everytime, when I would expect it to be tracing out the names of the subtopic movie clips.
function accessClips(){
//This will access the topic movie clips
for(var i:Number=0;i<Number(global_i.text);i++)
var scMenuItem:String = "mcMenuItem" + i;
var scContent:Object = this.getChildByName(scMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scContent:Object = "+ scContent);
//This is supposed to access the subtopic movie clips
for(var j:Number=0;j<Number(global_subi.text);j++)//
var scSubMenuItem:String = "mcSubMenuItem" + j;
var scSubContent:Object = this.getChildByName(scSubMenuItem);
trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>scSubContent:Object = "+ scSubContent);
Hope this makes sense, Chipleh confused. If the code is not clear enough, let me know and I'll try to further clarify.
Thanks again,
~Chipleh -
Access dynamically created objects
Hello!
I create some images dynamically by running a for from 1 to a
variable preset. The pictures have the IDs image1, image2 ...
("image"+i). I then add other properties.
Problem is for each I need an onMouseOverHandler thant will
swap the image with another.
I can get the target image with event.currentTarget.id. But I
cannot set it's properties with this["image"+i].source (I need to
change the ones up to that as well) and I cannot access it with
this.getChildByName("image"+i).source either.
What am I doing wrong please?"M*A*S*H 4077" <[email protected]> wrote in
message
news:go74q6$fbb$[email protected]..
> Hello!
>
> I create some images dynamically by running a for from 1
to a variable
> preset.
> The pictures have the IDs image1, image2 ...
("image"+i). I then add other
> properties.
>
> Problem is for each I need an onMouseOverHandler thant
will swap the image
> with another.
> I can get the target image with event.currentTarget.id.
But I cannot set
> it's
> properties with this["image"+i].source (I need to change
the ones up to
> that as
> well) and I cannot access it with
this.getChildByName("image"+i).source
> either.
>
> What am I doing wrong please?
ID is about as useful as your appendix when you create
objects dynamically.
The event.target property will contain a reference to your
image. -
Reg : Accessing dynamically created attribute
Hi All,
I had created a dynamic node ("demo") and added two attributes ("appid" & "apptext") to it. And also i created three elements for that node and binded the values. Now my dynamic node is having 3 records. I am creating link to action dynamically and binded a action called "onClick". Now in the output i am getting
linktoaction1
linktoaction2
linktoaction3
Now i am stuck with, when i am clicking either of these 3 linktoactions in runtime, i am able to get only the first record. May i know how to traverse through the node. i.e on clicking of linktoaction2 i want to fetch second records of the node and simillarly and linktoaction1 and linktoaction2. I used the following code in "onClick"
IWDNode dynnode = wdContext.currentContextElement().node().getChildNode ("demo",IWDNode.LEAD_SELECTION);
IWDNodeElement ele = dynnode.getCurrentElement();
String text = (String)ele.getAttributeValue("Apptext");
wdComponentAPI.getMessageManager().reportSuccess(text);
Thanks,
Mugundhan.Hi Nikil,
Ya i had assigned only one action for the three linktoactions. I am filling my dynamic node according to the number of records coming from the RFC. How can i pass the index value (i.e) how to identify that which action is being clicked. I am little confused. Thia is what i wrote in my coding,
In Init method,
IWDNodeInfo nodeInfo=wdContext.getNodeInfo().addChild("demo", null,true,true,
true,false,false,true,null,null,null);
nodeInfo.addAttribute("Applid", "com.sap.dictionary.string");
nodeInfo.addAttribute("Apptext", "com.sap.dictionary.string");
IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("demo",IWDNode.NO_SELECTION);
for(int i=0; i<wdContext.nodeEt_Mobileportal().size();i++)
IWDNodeElement nodeElem = node.createElement();
nodeElem.setAttributeValue("Applid", wdContext.nodeEt_data().getEt_dataElementAt(i).getApplid());
nodeElem.setAttributeValue("Apptext", wdContext.nodeEt_data().getEt_dataElementAt(i).getApptext());
node.addElement(nodeElem);
In domodify method,
if(firstTime)
IWDTransparentContainer cont= (IWDTransparentContainer)view.getElement("menu");
for( int i=0; i<wdContext.nodeEt_Mobileportal().size(); i++)
IWDLinkToAction link = (IWDLinkToAction)view.createElement(IWDLinkToAction.class,"link"+i);
link.setText(wdContext.nodeEt_Mobileportal().getEt_MobileportalElementAt(i).getApptext());
link.setOnAction(wdThis.wdGetGotoappAction());
cont.addChild(link);
Thanks,
Mugundhan -
6i dynamically create fields?
Hello all,
I'm working with a 6i report that has a comma-separated list of page numbers (index page).
Is there a way to use a format or other trigger to break each number into a hyperlink so that page numbers are clickable? The reports are saved as PDFs. Would the links save too?To make a textfield programmatically you can use something like this:
public CoreOutputText createOutputText(String text) {
CoreOutputText label = (CoreOutputText)FacesContext.
getCurrentInstance().getApplication().
createComponent(CoreOutputText.COMPONENT_TYPE);
label.setValue(text);
//System.out.println("label id = " +label.getId()); //TEMP
return label;
}I put that method in a UIComponentFactory class. To add the created OutputText to your PanelPage for instance you do:
CoreOutputText output = UIComponentFactory.getInstance().createOutputText();
getPanelPage().getChildren().add(output);Like this you add the output text to the the children of the panelpage.
To remove the output again you can use getPanelPage().getChildren().remove(output); -
Dynamic creating field names within Loop
Hi,
I've a record which comprises of a few key fields and then 52 qty fields, one for each week of the year. ( Not my design honest!!).
Anyway with in a Cursor there are currently 52 "IF" statements clearing out values less than the current week number. I'd tried to replace this with the following. However I'm having trouble with the " 'c1_rec.qty'| |lv_count " bit.
Has anyone got any ideas?
lv_week:=22; ( added for clarity )
lv_count:=1;
WHILE lv_count < lv_week LOOP
'c1_rec.qty'| |lv_count :=0;
lv_count:=lv_count+1;
END LOOP;
John-Paul ThompsonJohn-Paul;
If I understand the question correctly, you have a table with 52 columns, one for each week of the year. You are trying to zero the quantity for each week prior to the current week. I'm going to take a sab at this. Bear in mind that I have no way to debug the code.
DECLARE
c NUMBER;
n NUMBER;
v_sql VARCHAR2(2000)
lv_week NUMBER:=22; ( initialize week#)
lv_count NUMBER:=1;
BEGIN
v_sql := 'UPDATE c1_rec SET '
WHILE lv_count < lv_week LOOP
v_sql := v_sql| |
'qty'| |TO_CHAR(lv_count) | |' :=0';
lv_count:=lv_count+1;
IF lv_count < lv_week THEN
v_sql := v_sql | | ', ';
END IF;
END LOOP;
--sql := v_sql | | YOUR WHERE CLAUSE
c:= dbms_sql.open_cursor;
dbms_sql.parse(c, v_sql, dbms_sql.native)
n:= dbms_sql.execute(c);
dbms_sql.close_cursor(c);
END;
HTH
Randall
null -
Problem accessing dynamically created table line
Hi everyone.
I'm unable to solve the following problem:
In an offline scenario I have a table which contains one line at creation time. The form offers a button to add lines to the table using javascript and the instanceManager of the table.
If the added lines are beeing filled by the user I can extract that data without a problem.
But I cannot acces the newly generated fields with java script.
I'm not sure, what the problem is. Here is the code, which should do the job:
xfa.resolveNode("xfa.form.data.Inhalt.CONTACTS.DATA.NAMEV[" + position + "]").rawValue = 'Andreas';
This works fine, for the table line, that exists right from the beginning(position = 0), but not for any added line.
I keep getting this error: xfa.resolveNode("xfa.form.data.Inhalt.CONTACTS.DATA.NAMEV[" + position + "]") has no properties
What am I doing wrong?
Thanks for any hints,
Andreas.Solved the problem now and it was fairly easy looking at it now.
I don't know, why the above mentioned adressing does not work, but it works like this:
var tab = xfa.resolveNodes("xfa.form.data.Inhalt.CONTACTS.DATA[*]");
// get the last position
var last = xfa.resolveNodes("xfa.form.data.Inhalt.CONTACTS.DATA[*]").length - 1;
// fill values
tab.item(last).NAME1.rawValue = "Andreas";
Edited by: Andreas Heckele on May 17, 2010 11:07 AM -
This[id] doesn't see dynamically created objects????
Hey all!
If i have
<mx:Canvas id="TopCanvas" initialize="Init()">
<mx:Canvas id="VisibleCanvas" >
</mx:Canvas>
</mx:Canvas>
<fx:Script>
function Init(){
var NewO = new Canvas();
NewO.id="InvisibleCanvas";
TopCanvas.addChild(NewO);
if (this["VisibleCanvas"]){
//We can see non-dynamically created canvas
if (this["InvisibleCanvas"]){
//ERROR we cannot see the new one!
Help please! How to access dynamically created Canvases via their id? I know i can save linkage to them in array, but i need to do it through id.
Cheers!If you set the id property on a dynamically created instance, you can check
the id of an instance later if it happens to be a target of an event, for
example. But it will not be assigned to a variable in the document.
By default, MXML generates a non-dynamic class so you can't add properties
to it at runtime. You can set the name property and search the immediate
parent by calling getChildByName, but if the parent is not the document, you
still can't search the document.
Maybe you are looking for
-
What is diffrernce between key figures and characteristics?
Hi all, I am a newbie to SAP BI....i am doing Masters in ERP(SAP)....I have confusion about what is basic difference between key figures and characteristics? Why do we have to define attributes in characteristics? If any one can refer me a thread tha
-
Can't seem to get this computer to work with 3D
I just got this qosmio f755-3d350 today. I've spent a half day trying to get it working, and I'm starting to get frusterated with it. and the level of support. Comon Toshiba, you know better then releasing a product that doesn't work. and little supp
-
Read-only file access from network volume
I get an read-only file access from network volume problem while sharing a drive from Snow Leopard to a Tiger install. Most of files were opening well, but *.fp7 (FileMaker) and *.xls (Excel) files won't open dealing with a read-only error. As descib
-
Advantages of using activities over outlook
Hello, All Can any one explain me the advantages of using activities over outlook? In Outlook you can schedule the activities for the whole day, see if the period of an activity clashes with another activity so you can reschedule it etc. In short, ca
-
Router questions/suggestions please
My old Belkin died and I also have new components in the house that will use wireless and am looking for suggestions on what I need to get to support them all. House is about 1400 sq ft. I have a laptop and Wii in the living room, a PS3 in kids room