Counting Instances In a Text Field
I have an applet that contains 2 textfields. One text field contains any text that you care to paste or type in it. Using the other text field you type in a string that will then search the other text field and count the number of same occurences. This data is dynamically updated.
What would be the best way to implement this? Would I create a Char array out of each text field and then compare the two arrays to find the occurences? How would I create a char array out of a text field?
Thank you
Have a look at the following
http://java.sun.com/docs/books/tutorial/java/data/searchar.html
Similar Messages
-
Automatically display instance count in caption of text field
What is the code I use to make the caption of a text field show the instance count of its parent subform?
There is nothing wrong with your code....but you are assigning a numeric value to a string value and javascript does not seem to like that. If you modify the right side of the equation to be:
"" + this.parent.index
Then it seems to work.
Paul -
Instance name and Var for Input Text fields
I have several Input Text fields, as a form, linked to a PHP
script for which I require Var's for each field.
But I also need Instance names for each field, so I can fix
the tabIndex.
Yet, everytime I test my movie, the text fields have their
Paths (_level0.fName) written in them.
They are normally blank, and I've tried putting in some text
of my own, but the Var name is still displayed in the text fields.
Is there any way I can stop that from happening, and keep
both the Instance names and Var's in-place.
As far as I know, I need both the Instance name (for the
tabIndex) and the Var (for the PHP script) or is there a way that
the tabIndex and PHP script will work with either of the two?
Thanks
Chaz.Can you use a different name for ‘instance name’
and ‘var’? That seems to solve the problem but I
don’t know if that helps you in your situation.
For an example;
Instance name: test_txt
Var: test -
Competitor - Strategy and counter strategy text fields in Web UI
Hi,
I want to bring strategy & counter strategy text fields in the competitor screen of opportunity.
Component: BT130I_OPPT
View: BT130I_OPPT/CompetitorProdEF
.The other standard fields strength and weakness are already visible in WEbUI.
Also the text fieds strategy & counter strategy are visible in SAP GUI -opportunity - Competitor tab
In standard to display strength and weakness the view /CompetitorProdEF has 2 context nodes BTText1 (Relation BTTextIFirstchangable) and BTtext2 (Relation BTTextISecondchangable).
I tried to add new contect node for strategy & counter strategy (Relation BTTextIAll) but the save is not working properly.
Kindly suggest what needs to be done to make these standard text
types available in this view in WebUI
Thanks & Regards,
SanilaHi,
The issue is related to 'window.open("url")'. I replaced the above function with another script window.navigation("url).
When 'window.navigation' script is executed, browser is asking a security question whether to download the content or not. If i click yes, whole window is refreshed and existing data is gone. This happens only for first time when we try to download. After this the download is working fine without any session time out, if we are using the same window.
Kindly help if you have any inputs regarding the issue.
Thanks a lot.
Regards,
Arun N K. -
How to display a record count in a text field?
I am trying to return a record count of a query and place that count in a text field on my search page in APEX. I have that text field defined under Items on the search page. How do I get a query record count to display in my text field?
Thanks,
John
Edited by: user7381760 on Jan 22, 2009 3:47 PMHi Dan,
Thank you for your reply and yes I was able to select "Source Type" and "SQL Query". The SQL expression I used was:
SELECT COUNT(ID) FROM master_table;
This worked great to count the total number of records from the master_table. However what I am trying to do is to get a record count each time I complete a search from my search page. I have input fields on this page and a GO button which executes the query. The SQL query is location in one place under Regions/Display Point. My display field on my search page is named P16_COUNT2 and I was trying to make this work inside the main query code. I tryed something like this, COUNT(ID) INTO :P16_COUNT2, to pass the record count each time I execute the GO botton to P16_COUNT2 field. This I could not get to work. Any ideas how to proceed?
Regards,
John -
How can I count only text fields that have been used?
Hi,
I'm using Livecycle Designer for a dynamic form. I have a section of the form that contains field for the user to enter goals and then rate the goal. I'd like to count only the text fields with entries and then have the total number of rates divided by the number of text field entries.
Row 1 , column 1 -- Goal is to pick up 5 apples. Row 1, column 2 - the rate given is 5
Row 2, column 1 - Goal is to pick up 5 pears. Row 1, column 2 - the rate given is 5
Two goals for a total rating of 10 --- 10 divided by 2 = 5
Is it possible to count only those fields that are populated?
Also, is it possible to create an error message if the user entered 5 goals but only rated 4 of them?You could do a simple check for null and increase a counting variable if there's a value in the field. Here's a sample:
var goalCount = 0;
if (field1.rawValue != null){
goalCount = goalCount + 1;
if (field2.rawValue != null){
goalCount = goalCount + 1;
if (field3.rawValue... etc.
this.rawValue = totalPoints/goalCount;
where totalPoints is a sum of the values in the goal fields. This script is javascript and should be placed in the calculate event of the field showing your average score. -
If else conditional statements for dynamic text fields (as 2.0)
This is about a self assesment quiz.There will be four options and each one has a scale from1-5 ie "option a" has 1mark, "option b" has 2marks,"option c" has 3 marks, "option d" has 4marks and "option e" has 5 marks and we count the answerd and we display the scor for example if there are 20 question in it if they answered "option e" 5 times the score will be
25 and option d 5 times the score will be 20,anf if "option c" for 5 times the score will be 15,and "option b" for 3 times the score will be 6 and "option a" two times the score will be 2, and we add up all the score and display in a dynamic text field called "scor" and the total score is 68.And i have another dynamic text field called "tsc" where i have to display the tags like excellent , good, better ......ect.
Till now every thing is fine but i am unable to compare them it is displaying excellent even if i get 10 marks, i am unable to configure where i am going wrong.
If the score is greater than 55 "tsc" should display Excellent, if the score is greater than 41 or less than 55 "tsc" should display Best, if the score is greater than 26 or less than 40 "tsc" should display Better,if the score is none of the above "tsc" should display Poor.
This is my code on the submit button:
on (release) {
gotoAndStop("sQ");
if (scor>=55) {
tsc = "Excellent";
} else if (scor == 41 && scor<=55) {
tsc = "Best";
} else if (scor == 26 && scor<=40) {
tsc = "Better";
} else if (scor == 10 && scor<=25) {
tsc = "Good";
} else {
tsc = "Poor";
where:
"sQ" is the frame name where i am displaying the score details
"scor" is the var name for the dynamic text field for displaying total score
"tsc" is the var name for the dynamic text field for displaying the tags llike good, Excellent, better, poor.....etc
Plese help.......Use trace commands to make sure that what you think you are processing is what is actually hapenning.
Your middle conditionals are not written as you described them... any "==" should be ">="
It is recommended you get away from using the textfield var option... it can be troublesome to work with. Just assign an instance name to the textfield and assign the values to its text property... for instance, say you name it tscField, then you would use tscField.text = "Excellent";
Also, realize that the gotoAndStop command will not happen until after all the code executes in case that matters
on (release) {
gotoAndStop("sQ");
trace(scor);
if (scor>=55) {
tsc = "Excellent";
} else if (scor >= 41 && scor<=55) {
tsc = "Best";
} else if (scor >= 26 && scor<=40) {
tsc = "Better";
} else if (scor >= 10 && scor<=25) {
tsc = "Good";
} else {
tsc = "Poor"; -
I am completely new to lifecycle and I am having difficulty with a form. It is a relatively simple form; however in the section of the form with a table for invoice items I am having some difficulty. The problem is: an expanding table to allow the end user to add a row for additional invoice items and then it calculates a total item and grand total for the invoice.
I would like to have the item number generated automatically 1,2,3,4, ect but right now it starts at 0 (I think that might defeat the purpose of numbering items). I think this is counting the instances? I am not sure =(
Sorry if I did not adhere to the proper forum etiquette, or if I posted in the wrong place. I dont really know the ins and outs of this whole thing and I could really use some help!!
Here is the scripting in the form:(I think I need to change the first one, but how!?!)
// This script displays the instance value of the row in this text field.
// Invoke the Instance Manager to add one instance of the detail subform.
details._detail.addInstance(1);
//Invoke the recalculate method to include the field values from the added row in calculations.
// Invoke the Instance Manager to remove the current instance of the detail subform.Courtney Wilkins,
For future reference, the proper Adobe Forum to post such questions is the
LiveCycle Designer ES forum.
Have a look at the "Purchase Order -- Dynamic Interactive" sample that ships with Designer. You'll find it in the following folder:
{Designer_install_location}\{version}\EN\Samples\Forms\Purchase Order\Dynamic Interactive\Forms
It's a great example of a dynamic table with various sums.
As for the "item number", I'm assuming you mean the row index. If that's the case, then lets say you have a cell in your repeatable table row named "RowIndex" which is a text field. Also assuming you're running Designer 8.0 or later, you would add the following script to the row's IndexChange event (in JavaScript):
RowIndex.rawValue = (this.index + 1) + ".";
For more info, you could try the following posts and comments on my blog:
Calculate Scripts and
Instance Manager Object Reference.
Stefan
Adobe Systems
More answers at
Stefan Cameron on Forms. -
Dynamically created Text field inside of empty Movieclip
Hi there.
My goal is to have a button that, when clicked, an empty
movieclip is created and a text field is attached to it.
I could write it easily if the newly created instance names
where hard coded, the problem comes with the syntax to generate
them dynamically.
Here's the code i have so far:
ActionScript Code:
button.onRelease = function() {
createText();
var count:Number = 1;
createText = function () {
_root.createEmptyMovieClip("placeholder"+count,this.getNextHighestDepth());
this["placeholder"+count].createTextField("my_txt"+count,
this.getNextHighestDepth(), 100, 100, 100, 100); count++;
After that's done i still need to assign a text value to the
text field, which i have no clue on how to do it...
In other words I want to accomplish something like:
placeholder[count].my_txt[count].text = "my text";
I hope it's not confusing... Any help would be greatly
appreciated.
Thanks in advance!if your createText() function isn't working the way you want
check your use of "this" and "_root". if they're not the same,
you're not referencing your newly created movieclip correctly. and
your textfield depth isn't what you really want, but it should work
ok. -
Count instances of additional subforms using instance manager
I am familiar with using the following code in the calculate event in tables when the instance manager is used to add rows:
this.rawValue = this.parent.index+1;
However, I have a simple form that due to the need to expand the text field, I have used used a subform rather than table. While the instance manager works correctly, the number remains at one for each added instance.
A link to the form is here:
Dropbox - SMP Comments Form.pdf
Any help would be appreciated.Hi,
Using .parent only gets you to the StaticPortion object, you need to go one further up, so either use parent.parent or CommentSubform (which is the one that repeats).
If you change your calculate event code to the following you can remove the layout:ready code.
var count = _CommentSubform.count
this.rawValue = CommentSubform.index+1;
Regards
Bruce -
Unable to clear text Field in Multi Screen JFrame GUI Application
i am working with a Swing GUI project where I want to accept user input in a
text field
I have used singleton pattern which will create only one instance of object
due to this when i move from one scree to another the input of textfield
doesnt updated I have used setText method to clear the JTextField but it wont
works
Program one -- 1st screen
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.event.*;
import javax.swing.JTextField;
public class Frame1 extends JFrame
public static Frame1 frame1;
public JButton button;
public JTextField input;
public static Frame1 getInstance()
if(frame1==null)
frame1 = new Frame1();
return frame1;
public JButton getJButton(String mytext)
JButton button = new JButton();
button.setText(mytext);
button.setBounds(450,450,150,50);
return button;
public void myGUI()
JPanel panel = new JPanel();
panel.setLayout(null);
button = getJButton("1st Frame");
addActionListener(button);
input = new JTextField(10);
input.setBounds(200,300,100,30);
panel.add(input);
panel.add(button);
add(panel);
setUndecorated(true);
setSize(1024, 768);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
public void addActionListener(Object obj)
try{
JButton button1 = (JButton)obj;
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
String text = "";
input.insert("", 0);
Frame2.getInstance().myGUI();
Frame2.getInstance().repaint();
dispose();
catch(Exception e1)
System.out.println("Exception==> "+e1.toString());
public static void main(String[] args)
Frame1.getInstance().myGUI();
Frame1.getInstance().repaint();
program 2 - 2nd screen
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.event.*;
import javax.swing.JTextField;
public class Frame2 extends JFrame
static Frame2 frame2;
public JButton BackButton;
public JTextField input;
public static Frame2 getInstance()
if(frame2==null)
frame2 = new Frame2();
return frame2;
public JButton getJButton(String mytext)
JButton button = new JButton();
button.setText(mytext);
button.setBounds(450,450,150,50);
return button;
public void addActionListener(Object obj)
try{
JButton BackButton1 = (JButton)obj;
BackButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent ae)
input.setText("");
Frame1.getInstance().myGUI();
Frame1.getInstance().repaint();
dispose();
catch(Exception e2)
System.out.println("Exception==> "+e2.toString());
public void myGUI()
JPanel panel2 = new JPanel();
panel2.setLayout(null);
BackButton = getJButton("2nd Screen");
addActionListener(BackButton);
input = new JTextField(10);
input.setBounds(200,300,100,30);
panel2.add(input);
panel2.add(BackButton);
add(panel2);
setUndecorated(true);
setSize(1024, 768);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
In this application the status of TextField input remain same means it shows
the earlier input in the textfield wnen I come to earlier or next screen.
what is the solution to clear the TextField input while moving from 1st
scrren to 2nd screen.multiple screens = multiple posts
well done indeed - just another farking cross-poster
[http://www.coderanch.com/t/492998/Swing-AWT-SWT-JFace/java/unable-clear-text-box-Multi#2218566] -
Adding user-defined number of text fields.
Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
Feel free to run the program, the problem lies in the method setTextFields(). Help please!
import javax.swing.*; //FOR SWING COMPONENT CLASSES
import java.awt.*; //FOR CONTAINER CLASS
import java.awt.event.*; //FOR EVENT HANDLING
public class RegressInput extends JFrame
private JComboBox listJComboBox; //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
private JButton answerButton; //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
private JPanel textFieldTopPanel; //TEXT FIELD TOP PANEL
private JPanel textFieldBottomPanel; //TEXT FIELD BOTTOM PANEL
private JPanel textFieldPanel; //TEXT FIELD PANEL
private CardLayout cardSelector; //DECLARE CARD LAYOUT OBJECT
private JPanel cardDeck; //DECLARE CARD PANEL OBJECT
public RegressInput(String title)
super(title); //CALL SUPERCLASS CONSTRUCTOR
//CREATE A CONTAINER
Container container = getContentPane();
//INSTANTIATE CARD LAYOUT OBJECT
cardSelector = new CardLayout();
//INSTANTIATE PANEL OBJECT
cardDeck = new JPanel();
//SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
cardDeck.setLayout(cardSelector);
//DEFINE LABEL FOR FIRST CARD
Label question = new Label("How many PAIRS of data would you like to enter?");
//BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
answerButton = new JButton("OK");
listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
listJComboBox.setMaximumRowCount(10); //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
Label xValues = new Label("X Values"); //LABEL FOR X values
Label yValues = new Label("Y Values"); //LABEL FOR Y values
//BUILD CARD DECK
JPanel comboBoxCard = new JPanel(); //CREATE FIRST CARD
comboBoxCard.add(question); //ADD question LABEL TO FIRST CARD
comboBoxCard.add(listJComboBox); //ADD listJComboBox TO FIRST CARD
comboBoxCard.add(answerButton); //ADD answerButton TO FIRST CARD
textFieldTopPanel = new JPanel(); //CREATE TOP PANEL OF SECOND CARD
textFieldTopPanel.add(xValues); //ADD xValues Label TO SECOND CARD
textFieldTopPanel.add(yValues); //ADD yValues Label TO SECOND CARD
textFieldBottomPanel = new JPanel(); //CREATE BOTTOM PANEL OF SECOND CARD
textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10)); //SET LAYOUT FOR BOTTOM PANEL
textFieldPanel = new JPanel(); //CREATE PANEL FOR SECOND CARD
textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
textFieldPanel.add(textFieldBottomPanel, "South"); //ADD textFieldBottomPanel TO SOUTH
cardDeck.add(comboBoxCard, "Step 1"); //ADD FIRST CARD TO DECK
cardDeck.add(textFieldPanel, "Step 2"); //ADD SECOND CARD TO DECK
container.add(cardDeck); //ADD CARD DECK TO CONTAINER
//DEFINE BUTTON HANDLER OBJECT
ButtonHandler buttonHandler = new ButtonHandler();
//ADD ACTION LISTENER FOR BUTTONS
answerButton.addActionListener(new ButtonHandler());
}//END RegressInput() CONSTRUCTOR
//METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
private String[] getArray()
//CREATE ARRAY TO HOLD 30 VALUES
int numbers[] = new int[29];
//CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
int number = 2;
//ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
for(int count=0; count < 29; ++count)
numbers[count] = number; //SETS EACH INDEX TO number
number++; //INCREMENTS number
}//END for LOOP
//CREATE pairs[] ARRAY TO HOLD 30 STRINGS
String pairs[] = new String[29];
//ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
for(int count = 0; count < 29; ++count)
pairs[count] = "" + numbers[count];
}//END for LOOP
return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
}//END getArray() METHOD8
//RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
private int getValue()
//ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
Integer v = new Integer((String) listJComboBox.getSelectedItem());
//ASSIGNS WRAPPER VALUE TO int
int value = v.intValue();
//RETURN VALUE OF SELECTED ITEM
return value;
}//END getValue()
private void setTextFields()
{//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
for(int count = 0; count < (2 * getValue()); ++count)
}//END setTextFields()
//BUTTON EVENT HANDLER CLASS
private class ButtonHandler implements ActionListener
//PROCESS EVENT
public void actionPerformed(ActionEvent e)
//WHICH BUTTON CAUSED THE EVENT?
if(e.getSource() == answerButton)
cardSelector.last(cardDeck);
cardDeck.setSize(600,600);
}//END if STATEMENT
}//END actionPerformed()
}//END ButtonHandler CLASS
}//END RegressInput CLASSHere is main:
import javax.swing.JFrame;
public class TestSharpStats
public static void main(String[] args)
//DEFINE FRAME OBJECT
RegressInput window = new RegressInput("Hi"); //SETS TITLE BAR
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //CLOSES WINDOW
window.setSize(400, 600); //SET FRAME SIZE
window.setResizable(true); //PREVENTS USER FROM RESIZING WINDOW
window.setVisible(true); //SETS window TO VISIBLE
}//END main()
}//END TestSharpStats CLASSmuit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652
-
How Can i send the data entered in Input text fields to e-mail?
Iam Jennifer, Iam having a doubt in Flash, I hope that you
are going to solve my problem, Iam taking 3 Static text fields as
Name, Age and Country and besides each and every static text fields
i have taken 3 input text fields with different instance names,
when i enter my Name, Age and Country details in the input text
fields and after entering those details if user clicks the submit
button the data should be send to some mail address, is it possible
Im not so good at action script, but i hope that any one can
help me...
Iam attaching the action script code also, please find the
attachment below, the actions are given to button.
Attach Code
Btn.onPress = function ()
mail_lv = new LoadVars();
mail_lv.dummy1 = "";
mail_lv.subject = "Details";
mail_lv.message = "hi";
mail_lv.username = "name_txt".text;
mail_lv.age = "age_txt".text;
mail_lv.country = "country_txt".text;
mail_lv.onLoad = function ()
trace("Sent successfully...");
trace("mail_lv.subject = " + mail_lv.subject);
trace("mail_lv.message = " + mail_lv.message);
mail_lv.send("mailto:[email protected]", "_blank");The names of your variables, "name_txt", for instance, should
NOT have quotes around them. Use:
mail_lv.username = name_txt.text;
mail_lv.age = age_txt.text;
mail_lv.country = country_txt.text; -
How do I set the value of a dynamic row text field
I have a repeated row form which contains a button and multiple text fields. There is a text field (Input Data Field) further up with some information I want to place in the table and multiple buttons that I want to read the value of and set to the table. I apologize there are multiple questions I have and I am using pseudocode to describe it.
Top form looks like
InputField
| ButtonX1 | ButtonY1 | DescriptionX1 (read only Text Field)
| ButtonXn | ButtonY1 | DescriptionXn
OutputRow looks like
| ButtonOutput | OutputField1 | OutputField2 | OutputField3 |
So I would like it to do
ButtonX1.click
OutputTable.OutputRow.addInstance(true) //this works - everything else I have questions on
OutputTable.OutputRow.OutputField1.rawValue = DescriptionX1.rawValue
Question 1
How do I address the location in each table to set a value
Question 2
How do I get the value of the description field in the same table and row as the button
I would like to say something to the effect of OutputTable.OutputRow[??].OutputField1.rawValue = this.parent.DescriptionX
OutputTable.OutputRow.OutputField2 = InputField.rawValue
Same question as above - how do I specify a dynamic row - is this the proper syntax for getting the value from the input field?
OutputTable.OutputRow.OutputField3 = this.ButtonLabel
Question 3
How can I get the value of the button's label to set in the field
There should be very many of these buttons and buttons will be added - I would prefer to set the value based on the button's label to make the value easier - not requiring changing the code
Question 4 - unrelated to those above.
Is it possible to build the first table
| ButtonX | ButtonY | Description |
from an XML File. I have seen examples of how to build if it is just data, but can the XML be pushed into a form with code to do the above actions?Each object in a form must have a unique name. I doing so it is not neccessarily the name but the path or SomExpression associated with that object that must be unique. In your case you have a Table.Row.object configuration. The Row is the part that is repeating so to give each object a unique name an instance number is placed on the repeating part. So objects in the 1st row woudl be Table.Row[0].object...objects in the second row woudl be Table.Row[1].object etc .....You can see this by adding a debug instruction on the Enter event of the description field. Put the code app.alert(this.somExpression) and when you enter the field you will see what the somExpression is. Do this for a few rows and you will see the pattern (don't forget to remove the debug code from the enter event). Now you know what you have to use to address the fields. If no instance is given it is assumed to be 0 ..that is why only the 1st row is being affected.
So now to answer your questions:
Question1: The square bracket notation is an issue for javascript (this is the notation for an array) so we have to use a different means of addressing the field to include the instance number. So to address the Description in the 3rd row we woudl use:
xfa.resolveNode("Table.Row[2].Description").rawValue = "This is my new description";
Note that the instance number is 2 for the 3rd row because the instance numbers are 0 based.
Question2. The resolveNode notation allows you to pass a string so you can also concatinate expressions to make the string. If you are writing code on a button in the same row you can get the instance that you are on by using the expression this.parent.index. The "this" portion refers to the current object (the button) and the parent.index gets you th eindex of the Buttons parent. If the button is embedded deeper in a hierarchy then you can continue to add parent indicators until you get back to the node that you want. So rewriting your expression from Q1 it woudl be:
xfa.resolveNode("Table.Row[" + this.parent.index + "].Description").rawValue = "This is my new description";
Question3: The buttons caption can be retrieved by using ButtonName.caption.value.text.value
Question4: When you say build from an XML file. What are you expecting to come from the XML file? The caption that goes on the button? Typically the XML file carries data (not to say that it cannot carry other things). Just need a bit of clarification on this one first.
Hope that helps
Paul -
Problem with Refreshing the data bound text fields
Folks,
First of all, this a GREAT product and I am moving my apps from Eclipse to Studio Creator. I am very impessed with it so far.
I am gone through most tutorials, but can't help resolve the problem that I am having. I have a page, that lists all the users in a table. When you click on any user, it opens up another page that lists the detail of the specific user you have clicked on. This a typical use in most web applications, right?
In the user detail page, I open it in "Read" only mode, by setting the "setReadOnly" to true for all text field components. Then users can edit it by clicking "Edit" button. Edit button just changes the "setReadOnly" to false, to allow editing. After editing, they can hit the "Save" button to save the changes. In the save button, I call this code:
public void prerender() {
try {
userID=getSessionBean1().getUserID();
getSessionBean1().getWeb_userRowSetUserDetail().setObject(1,userID);
getWeb_userDataProviderUserDetail().refresh();
info("prerender: Refresh called");
} catch (Exception ex) {
error("Error in userForm.prerender():"+ex.getMessage()+ex.getStackTrace());
log("Error in userForm.prerender():", ex);
setReadWrite();
public String btnSave_action() {
try {
getWeb_userDataProviderUserDetail().commitChanges();
getWeb_userDataProviderUserDetail().refresh();
info("Data Provider Refreshed in SAVE");
_readOnly=true;
form1.discardSubmittedValues("saveVForm");
info("User Updated New:"+userID);
} catch (Exception ex) {
log("Error Description", ex);
return null;
public String btnEdit_action() {
try {
_readOnly=false;
//info("User ID Edt="+getSessionBean1().getUserID());
} catch (Exception ex) {
error("Error in userForm.btnEdit_action:"+ex.getMessage()+ex.getStackTrace());
log("Error in userForm.btnEdit_action():", ex);
return null;
private void setReadWrite(){
// Set read-only to true or false for all text fiels
this.btnEdit.setVisible(_readOnly);
this.btnSave.setVisible(!_readOnly);
this.user_id.setReadOnly(_readOnly);
this.user_email_client.setReadOnly(_readOnly);
this.user_email_office.setReadOnly(_readOnly);
this.user_fname.setReadOnly(_readOnly);
this.user_lname.setReadOnly(_readOnly);
this.user_id.setReadOnly(_readOnly);
this.user_password.setReadOnly(_readOnly);
this.user_password_conf.setReadOnly(_readOnly);
this.user_phone_cell.setReadOnly(_readOnly);
this.user_phone_cell_aac.setReadOnly(_readOnly);
this.user_phone_client.setReadOnly(_readOnly);
this.user_phone_home.setReadOnly(_readOnly);
this.user_phone_office.setReadOnly(_readOnly);
}When the save button is clicked, the database is updated (as I can verify by looking directly into the database), but the data-bound text fields do not display the new value. YES, I am calling refresh() on data provider? I tried to call refresh in both "preRender()" and "Save" button action event, but that did not help either.
Please note that the save button also changes the "setReadOnly" back to TRUE for all text fields. That means, users view the page in Read-Only mode after saving. (They have to click on "Edit" button again to edit it). I discovered that if I do not set the text field components in "ReadOnly" mode, then they display the updated value of the fields. But if I change setReadOnly to TRUE, then they display the old values (before the save).
Any idea what I am doing wrong here?
ThanksHere is my experience with it. I have three text
boxes to be filled out. They are part of a virtual
form with an add button as the submit. You can fill
out the 3 and add them and a node is added to a tree
component. When you click on a node in the tree
component (the submit to another virtual form that
the 3 buttons participate in) the text fields should
be loaded with the values that they where added with.Hard to tell from this explanation, but if the text fields do not participate in a virtual form, then they are not going to get updated when an action in the virtual form happens. Not sure this is your problem. Like I say, hard to tell from this explanation.
They will not display the values though...having
nothing to do with read only. If I disable them
before hand...they display the updated values. If I
set their value at the top or bottom of prerender,
they display the change...if I set the value in an if
conditional that is hit (I have checked many times)
in prerender, they will not display the values. If I
set them in the tree handler anywhere, they will not
display the values. This is very frustrating and is
wasting tons of my time...I simply want to load the
text fields based on the tree node that was
clicked...I have messed with this for hours and it
certainly does not work.Well, setting them in the tree handler won't work because the tree handler gets called in the page instance that handles the submit and not the page instance that renders the response.
Posting your prerender code might help. Also, your action handler.
>
>
- Mark
Maybe you are looking for
-
Another IISPROXY question (multiple SAP systems)
Hi! We've got a challenge. We have SAP EP (6.0 SP12), visible from outside (via MS ISA server publishing). Also we have several SAP systems (BW, ERP2004, Solution Manager), that we want to make available from web. We installed IIS proxy module on po
-
Making field mara-maktl not mandatory in mm02/mm01
hello sdn people, hopefully the economy is not in peril where you are... as my subject line states, i have checked the transactions OMSR / OMS9 and it shows that the field should be display, but it is still required. i would like to turn this off so
-
it would be really swell to be able to redefine many DDK functions to reduce extraneous overhead. For example the function: inline tMSeries::tInterrupt_A_Ack& tMSeries::tInterrupt_A_Ack::setG0_Gate_Error_Confirm(u16 fieldValue, nMDBG::tStatus2* s)
-
In the browser Chrome, after going to a website starting with https://, it gave me the below message: Mixed Content: The page at 'https://...' was loaded over HTTPS, but requested an insecure resource 'http://...'. This request has been blocked; the
-
Transport of config objects...business system prblem...
Hi Gurus, We want to transport dev and config objects from XI qua to a XI test server... we hav successfully transported all design objects...but we are facing problem while transporting the config objects because of business and technical system