Dynamically generating input grid
I am trying to figure out a way to let users dynamically generate rows of input text boxes using a button in an HTML page e.g. user will enter text in say 10 columns and then hit enter, which will create another row of text boxes with same number of columns. Also all the text boxes should automatically generate their names e.g. if the column name is "Address" then the name of the first address text box in the first row should be e.g. "address_1" and then name of the second address text box should be e.g. "address_2".
I want to do this on the client side, so that I can gather all the information and then only pass it on to the server.
Any help would be greatly appreciated.
Thx
Depends on how you have build your JSP page. Assuming:
1. You have built your .JSP with one or more .java files. Then the previous example that our friend answered you is write but converted into java code and not in javascript. In case you dont understand how you can build a JSP file with .java file i explain:
you write Java code in a .java file but it has HTML tags. When your code is executed the tags are "created" because your code says so. And this is the way your .JSP is being built. In there you can create a sequence with for or anything else you figure out to build more and more lines. For the names figure out a generator method.
2. You have built your code with another tool (Dreamweaver) and you dont want or know to use java code to create more lines. Then i suggest you a middle way:
Figure out how many lines will be created from your users more or less. Let's say that more or less users create from 4-6 lines. Create your lines already, put names on them with a generator but have them disabled (type="textfield" ....... disabled>). Then use javascript so when the user wants to have more lines or rows allow with javascript the second row to be enabled and so on. When you reach your final line or row but the user still wants more lines, have a button saying "More" or sth like that and reload the page but be sure to store the previous entered values. I hope i helped.
P.S. Maybe also try to change that by putting a textarea unless it doesnt help. Let me know what you think.
Similar Messages
-
Generate input text fields dynamically on clicking a image with adf??
Is it possible to generate input text fields dynamically on clicking a image with adf??
The functionality to add and remove text field from UI with ADF??Yes, you can dynamically add components to a page.
[url http://www.nearinfinity.com/blogs/michael_bevels/dynamic_forms_using_jsf.html]Here is an example - it demonstrates with ICE Faces components, but the concept is the same for any type of component, including ADF
John -
Using Actionscript to generate a grid
Hello all.
I am working on a Flash project and have a problem that has
turned out to be a real head scratcher for me. I need to create a
Flash form that will generate a floorplan grid based upon width and
length values entered by the user. I have successfully completed
part of the task and I am able to generate a grid based upon the
width and length entered by the user.
Here is my problem: When the Width and Length "units" are
entered as feet, I need to generate a grid that displays 1 grid
square for every 5 feet of length or width entered, (the scale is 1
square grid = 5 ft so if you entered a 50 ft building length or
width the "length or width" side of the grid would be 10 grid units
in length). Then, if the user re-enters new values for the width
and height and clicks "draw floorplan"
again
the grid needs to regenerate
again
at the proper size. Currently my sample generates 1 grid for
every foot of length or width entered and will not regenerate
properly.
Below is a link to a sample of where I am so far as well as
the Actionscript I am using to control the sample file.
Can anyone provide some pointers on how to generate the grid
with one grid representing 5ft and how to regenerate the grid once
new values are input and the "draw floorplan" button is clicked
again? (Also, ultimately I need to then send the form data as
email.)
Any help is very much appreciated!
Bitjammer
Link to sample:
http://216.197.127.249/grid/grid_sample_1.html
(Try entering 10 width and 10 length then click draw floor
plan)
Here is my actionscript code so far:
my_button.addEventListener("onPress",gridf);
my_button.onPress=function(){if(Number(widthTF.text)>1&&Number(heightTF.text)>1){gridF(Num ber(widthTF.text),Number(heightTF.text))
function gridF(h,w){
initX = 0;
initY = 0;
counter = 0;
for (var i = 1; i<=h; i++) {
for (var j = 1; j<=w; j++) {
counter++;
grid_container.attachMovie("cellMC", "cell"+counter,
counter);
grid_container["cell"+counter]._x = initX;
grid_container["cell"+counter]._y = initY;
initX += 15;
initY += 15;
initX = 0;
(For clarification: the width input variable is widthTF and
height input varible is heightTF.)Thanks for taking time to answer my post, kglad.
Yes. I believe I understand. I could create another button
and call it "Reset Grid" and call this function, however what I am
hoping for is to have the grid redraw simply by the user entering
new values for the width and height and then clicking "draw
floorplan" again.
Currently the first line of code is:
my_button.addEventListener("onPress",gridf); Should not the grid
redraw each time and then parse the new values in the width and
height fields? I am sure I am just dense but my grid is not
clearing each time the "draw " button is clicked.
You can see this happen on the sample link below. After
entering say 20 width and 20 height values and clicking "draw"
button, the grid is created perfectly. Then if, say new values of
10 width and 10 height are entered and "draw" button is clicked,
the grid does not redraw correctly using these new values.
Sample link:
http://216.197.127.249/grid/grid_sample_1.html
Could the problem be that the gridf function should happen as
the first function in the script before the new values are parsed
again? Should a: grid_container.removeMovieClip(); execute before
anything else is executed each time the "draw" button is clicked? -
Making a dynamically generated field as Read Only
Hi All,
I am extending a standard CO and in that I wanted to make an entire table as read only. I checked by personalizing the page from front end, but as the items are dynamically generated fields , they are not visible in personalize page.
So is there any way to cach these fields and make them read only programmatically.
Thanks,
SrikanthHi Pratap,
I have looked into the view source and took the name of a input type ( There is no ID for the field) and used it in findIndexedChild, but it returns a null. I guess this is happening is the current CO is a mere region level CO and it is not being given the access.
The code in the class file is as follows :
public static void processTable(OAPageContext oapagecontext, OAWebBean oawebbean)
oapagecontext.startTimedProcedure("CrossTableCO", "processTable");
String s = null;
String s1 = null;
int i = oawebbean.getIndexedChildCount();
String as[[][]] = new String[7];
int j = 0;
String as1[[][]] = new String[i][6];
for(int k = 0; k < oawebbean.getIndexedChildCount(); k++)
UINode uinode = oawebbean.getIndexedChild(k);
if(!(uinode instanceof OAMessageStyledTextBean))
continue;
OAMessageStyledTextBean oamessagestyledtextbean = (OAMessageStyledTextBean)uinode;
if(oamessagestyledtextbean.isRendered())
oamessagestyledtextbean.setRendered(false);
oamessagestyledtextbean.setAttributeValue("benCustomBeanRender", "Y");
if("TotalPlanLabel".equals(oamessagestyledtextbean.getUINodeName()))
s1 = oamessagestyledtextbean.getLabel();
continue;
if(s == null)
s = oamessagestyledtextbean.getViewUsageName();
as[j][0] = oamessagestyledtextbean.getViewAttributeName();
as[j][1] = oamessagestyledtextbean.getSortByAttributeName();
as[j][2] = oamessagestyledtextbean.getLabel();
as[j][3] = oamessagestyledtextbean.getExportByViewAttrName();
as[j][4] = oamessagestyledtextbean.getDestination();
as[j][5] = oamessagestyledtextbean.getUINodeName();
as[j][6] = oamessagestyledtextbean.getDataType();
if(as[j][4] != null && as[j][5] != null)
as1[j][0] = as[j][5];
as1[j][1] = as[j][0];
as1[j][2] = s;
as1[j][3] = as[j][4];
as1[j][4] = as[j][6];
as1[j][5] = as[j][3];
j++;
continue;
if("TotalPlanLabel".equals(oamessagestyledtextbean.getUINodeName()))
s1 = "XXHideXXTotalXX";
oawebbean.setAttributeValue("CrossTableUpdateInfo", as1);
oawebbean.setAttributeValue("CrossTableRenderCount", Convert.getString(j));
if(s == null)
return;
OAViewObject oaviewobject = (OAViewObject)oapagecontext.getApplicationModule(oawebbean).findViewObject(s);
if(oaviewobject == null || !oaviewobject.isPreparedForExecution() || oaviewobject.first() == null)
return;
} else
oawebbean.addIndexedChild(createTable(oawebbean, oaviewobject, as, j, s1));
oawebbean.setAttributeValue("CrossTableRowCount", Convert.getString(oaviewobject.getRowCountInRange()));
oapagecontext.endTimedProcedure("CrossTableCO", "processTable");
return;
private static UINode createTable(OAWebBean oawebbean, OAViewObject oaviewobject, String as[][], int i, String s)
int j = oaviewobject.getRowCountInRange();
DataTextNode datatextnode = new DataTextNode(new DataBoundValue("text"));
String as1[] = new String[j + 1];
CrossTableData acrosstabledata[] = new CrossTableData[i];
int k = -1;
for(int l = 0; l < i; l++)
acrosstabledata[l] = new CrossTableData(new CrossTableCellData[j + 1]);
for(int i1 = 0; i1 <= j; i1++)
if(i1 > 0)
try
if(s != null && j > 1 && CT_NUM_MINUS_ONE.equals(oaviewobject.getRowAtRangeIndex(i1 - 1).getAttribute("GroupOiplId")))
as1[i1] = s;
else
as1[i1] = (String)oaviewobject.getRowAtRangeIndex(i1 - 1).getAttribute("Name");
catch(Exception exception)
datatextnode = null;
as1[i1] = "";
if(k < 0 && j > 1 && "XXHideXXTotalXX".equals(s) && CT_NUM_MINUS_ONE.equals(oaviewobject.getRowAtRangeIndex(i1 - 1).getAttribute("GroupOiplId")))
k = i1;
for(int j1 = 0; j1 < i; j1++)
if(i1 == 0)
acrosstabledata[j1].getData()[i1] = new CrossTableCellData(as[j1][2]);
else
acrosstabledata[j1].getData()[i1] = new CrossTableCellData(null, as[j1][2], oaviewobject, i1 - 1, as[j1][0], as[j1][1], as[j1][3], as[j1][4], as[j1][5], as[j1][6]);
TableBean tablebean = new TableBean("CrossTable", new ArrayDataSet(acrosstabledata), null, null, datatextnode, new ArrayDataSet(as1, "text"));
tablebean.setWidth("100%");
tablebean.setSummary(" ");
tablebean.setNameTransformed(false);
tablebean.setTableFormat(new DictionaryData("tableBanding", "rowBanding"));
tablebean.setID((new StringBuilder()).append("CrossTable").append(oawebbean.getID()).toString());
oawebbean.setAttributeValue("CrossTableId", tablebean.getID());
DictionaryData adictionarydata[] = new DictionaryData[j + 1];
Object obj = null;
Object obj1 = null;
for(int k1 = 0; k1 <= j; k1++)
OAWebBean oawebbean1 = createColumn(k1);
if(k1 == k)
oawebbean1.setRendered(false);
tablebean.addIndexedChild(oawebbean1);
if(k1 == 0)
adictionarydata[k1] = new DictionaryData("columnDataFormat", "textFormat");
continue;
try
String s1 = (String)oaviewobject.getRowAtRangeIndex(k1 - 1).getAttribute("TextFormat");
if("Y".equalsIgnoreCase(s1))
adictionarydata[k1] = new DictionaryData("columnDataFormat", "textFormat");
else
adictionarydata[k1] = new DictionaryData("columnDataFormat", "numberFormat");
catch(Exception exception1)
adictionarydata[k1] = new DictionaryData("columnDataFormat", "numberFormat");
tablebean.setColumnFormats(new ArrayDataSet(adictionarydata));
return tablebean;
private static OAWebBean createColumn(int i)
OAFlowLayoutBean oaflowlayoutbean = new OAFlowLayoutBean();
OAMessageTextInputBean oamessagetextinputbean = new OAMessageTextInputBean();
OAMessageStyledTextBean oamessagestyledtextbean = new OAMessageStyledTextBean();
OAMessageDateFieldBean oamessagedatefieldbean = new OAMessageDateFieldBean();
OASwitcherBean oaswitcherbean = new OASwitcherBean();
Hashtable hashtable = new Hashtable();
hashtable.put("CtPPRTrgCol", new DataBoundValue(new CrossTableColumnData(i, "Name")));
oaswitcherbean.setNamedChild("input", oamessagetextinputbean);
oaswitcherbean.setNamedChild("date", oamessagedatefieldbean);
oaswitcherbean.setChildNameBinding(new CrossTableColumnData(i, "Render"));
oaflowlayoutbean.addIndexedChild(oaswitcherbean);
oaflowlayoutbean.addIndexedChild(oamessagestyledtextbean);
oamessagetextinputbean.setNameBinding(new CrossTableColumnData(i, "Name"));
oamessagetextinputbean.setTextBinding(new CrossTableColumnData(i, "Text1"));
oamessagetextinputbean.setAttributeValue(DESCRIPTION, new DataBoundValue(new CrossTableColumnData(i, "Label")));
oamessagetextinputbean.setAttributeValue(COLUMNS_ATTR, "12");
oamessagetextinputbean.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, OAWebBeanUtils.getFirePartialActionForSubmit(oamessagetextinputbean, null, "update", hashtable, null));
oamessagetextinputbean.setDataType("NUMBER");
oamessagetextinputbean.setAttributeValue(READ_ONLY_ATTR, new DataBoundValue(new CrossTableColumnData(i, "ReadOnly")));
oamessagetextinputbean.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, new DataBoundValue(new CrossTableColumnData(i, "SubmitValidator")));
oamessagedatefieldbean.setNameBinding(new CrossTableColumnData(i, "Name"));
oamessagedatefieldbean.setTextBinding(new CrossTableColumnData(i, "Text1"));
oamessagedatefieldbean.setValueBinding(new CrossTableColumnData(i, "Text1"));
oamessagedatefieldbean.setAttributeValue(DESCRIPTION, new DataBoundValue(new CrossTableColumnData(i, "Label")));
oamessagedatefieldbean.setAttributeValue(COLUMNS_ATTR, "12");
oamessagedatefieldbean.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, OAWebBeanUtils.getFirePartialActionForSubmit(oamessagedatefieldbean, null, "update", hashtable, null));
oamessagedatefieldbean.setDataType("DATE");
oamessagedatefieldbean.setAttributeValue(READ_ONLY_ATTR, new DataBoundValue(new CrossTableColumnData(i, "ReadOnly")));
oamessagestyledtextbean.setTextBinding(new CrossTableColumnData(i, "Text2"));
return oaflowlayoutbean;
Pls let me know for any clarifications.
Thanks,
Srikanth -
Many times dynamic generate UIElement at Runtime ???
Hello Everyone,
I wanna generate a UIElement (InputField) at runtime. When man click a button "Add InputField", then a UIElement (InputField) is dynamic generated. Man can generate many times UIElement"InputField" with this button.
I have tried the Webdynpro Tutorial 17. But not yet any idea.
Plx give me some suggestions and code.
Thanks in advance
best regards
Yaninghi
for this create 2 int variables <b>act</b> and a <b>counter</b>
//@@begin others
static int act,counter=0;
//@@end
<b>in Doinit set act to 0.</b>
public void wdDoInit()
//@@begin wdDoInit()
act=0;
//@@end
<b>create an action(onActionCreate_Element) and assign it to the button ui element</b>
public void onActionCreate_Element(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionCreate_Element(ServerEvent)
act = 1;
//@@end
<b>in wdDoModifyView</b>
public static void wdDoModifyView(IPrivateDynamicView wdThis, IPrivateDynamicView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
//@@begin wdDoModifyView
if( act== 1)
IWDTransparentContainer con= (IWDTransparentContainer)view.getElement("RootUIElementContainer");
IWDInputField input = (IWDInputField)view.createElement(IWDInputField.class,"input1"+counter);
IWDAttributeInfo test = wdContext.getNodeInfo().addAttribute("name"+counter,"ddic:com.sap.dictionary.string");
input.bindValue(test);
input.setVisible(WDVisibility.VISIBLE);
counter++;
con.addChild(input);
act = 0;
//@@end -
Issue with emailing dynamically generated PDF (InteractiveForm UI element)
Hi Experts ,
I have a requirement according to which i need to generate PDF dynamically using webdynpro java and email the dynamically generated PDF.
I am facing issue while emailing the dynamically genarated pdf.
It gives me an exception :
nested exception is: javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.IOException: no data
This is because its unable to get the binary data (byte array) of the dynamically generated PDF which is required to send mail.
Could some one suggest me how to fetch the binary data of the dynamically generated PDF.
For dynamic PDF generation i am using dynamic generation of UI element InteractiveForm UI Element
In case of static PDF (i.e. the PDF genarated by inserting the InteractiveFrom Ui element on the view using the insert child option) we do set the pdf source property of Interactive Form UI element to a context variable attribute of type binary but my problem is ,how to set the PDF source of a dynamically generated Interactive form UI element to a context variable attribute of type binary ..
Any help would be highly appreciated.
Regards ,
NavyaHi Frank ,
the code to generate PDF dynamically is written in the WdDoModifyView section of the view as the PDF need to be generated dynamically., i.e. by adding InteractiveForm UI elements at runtime.
I tried the code suggested by you but i gave mean exception.
errorjava.io.FileNotFoundException:
(The system cannot find the path specified)
Kindly let me know where i am going wrong .
Below is the code that i had written in a separate method m_mail().
This would take as input the name of the dynamically generated data node and is called from the wdDoModifyView section of the view
public void m_mail( java.lang.String p_dynamicnodeName )
ByteArrayOutputStream templateSourceOutputStream = new ByteArrayOutputStream();
// This would need to have the Templatefile in the Mimes-Directory of the Webdynpro-Component
String templateUrl = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), "AdobeView1_InteractiveForm.xdp");
InputStream templateSourceInputStream = new FileInputStream(templateUrl);
IOUtil.write(templateSourceInputStream, templateSourceOutputStream);
IWDPDFDocumentCreationContext pdfContext = WDPDFDocumentFactory.getDocumentHandler().getDocumentCreationContext();
pdfContext.setData(WDInteractiveFormHelper.getContextDataAsStream(wdContext
.nodeCtx_vn_dynmcnd()
.getChildNode(p_dynamicnodeName, IWDNode.NO_SELECTION)));
pdfContext.setTemplate(templateSourceOutputStream);
pdfContext.setInteractive(false);
IWDPDFDocument pdf = pdfContext.execute();
if (pdf != null) {
pdfArray = pdf.getPDF();
Kindly let me know where am i going wrong.
Regards ,
Navya -
Loading a dynamic generated profile... not really working
Hey all - ok simple question sort of.
I am generating a dynamic profile for the encoder. It's to save to c:\videos on output with each user's unique id in the file name. The user goes to a secure login, clicks the download profile link - and bam I have the XML file set to auto-open in Flash Media Encoder. Problem is - it is not using my dynamically generated filename. If I go to flash media encoder and OPEN Profile - and open the profile that was downloaded - all is well and the filename in the save to file is correct. If you try to click on the profile file (xml file) or have firefox auto-open xml file into flash media encoder - it opens up the encoder but does not adjust any settings including the save to file location.
So my question is - is it possible to start a custom profile by simply clicking on the profile xml file (default app for it is the encoder)?? I have read up on the cmd line - option but that won't be an option in this case as we just want users to download / start a recording session.
Here is a sample of the profile generated:
I bolded the part that gets dynamically generated....
<?xml version="1.0" encoding="UTF-16"?>
<flashmedialiveencoder_profile>
<preset>
<name>Custom</name>
<description></description>
</preset>
<capture>
<video>
<device>Integrated Webcam</device>
<crossbar_input>0</crossbar_input>
<frame_rate>15.00</frame_rate>
<size>
<width>320</width>
<height>240</height>
</size>
</video>
<audio>
<device>Microphone (High Definition Aud</device>
<crossbar_input>0</crossbar_input>
<sample_rate>22050</sample_rate>
<channels>2</channels>
<input_volume>75</input_volume>
</audio>
</capture>
<process>
<video>
<preserve_aspect></preserve_aspect>
</video>
</process>
<encode>
<video>
<format>VP6</format>
<datarate>200;</datarate>
<outputsize>320x240;</outputsize>
<advanced>
<keyframe_frequency>5 Seconds</keyframe_frequency>
<quality>Good Quality - Good Framerate</quality>
<noise_reduction>None</noise_reduction>
<datarate_window>Medium</datarate_window>
<cpu_usage>Dedicated</cpu_usage>
</advanced>
<autoadjust>
<enable>false</enable>
<maxbuffersize>1</maxbuffersize>
<dropframes>
<enable>false</enable>
</dropframes>
<degradequality>
<enable>false</enable>
<minvideobitrate></minvideobitrate>
<preservepfq>false</preservepfq>
</degradequality>
</autoadjust>
</video>
<audio>
<format>MP3</format>
<datarate>48</datarate>
</audio>
</encode>
<restartinterval>
<days></days>
<hours></hours>
<minutes></minutes>
</restartinterval>
<reconnectinterval>
<attempts></attempts>
<interval></interval>
</reconnectinterval>
<output>
<file>
<limitbysize>
<enable>false</enable>
<size>10</size>
</limitbysize>
<limitbyduration>
<enable>false</enable>
<hours>1</hours>
<minutes>0</minutes>
</limitbyduration>
<path>C:\Videos\M02634365_01_10_11_03_58_PM.flv</path>
</file>
</output>
<metadata>
<entry>
<key>author</key>
<value></value>
</entry>
<entry>
<key>copyright</key>
<value></value>
</entry>
<entry>
<key>description</key>
<value></value>
</entry>
<entry>
<key>keywords</key>
<value></value>
</entry>
<entry>
<key>rating</key>
<value></value>
</entry>
<entry>
<key>title</key>
<value></value>
</entry>
</metadata>
<preview>
<video>
<input>
<zoom>100%</zoom>
</input>
<output>
<zoom>100%</zoom>
</output>
</video>
<audio></audio>
</preview>
<log>
<level>100</level>
<directory>C:\Users\recordpharmacy\Videos</directory>
</log>
</flashmedialiveencoder_profile>Unfortunately no.
Put simply, there are a few major intel-related changes going on right now, and the short story is that the intel drivers are using newer tech than Mesa and such are. However, the required packages haven't been brought up to date yet (I think they haven't been marked stable upstream and such).
The first step however is kernel 2.6.28, which includes half of the "fix", to simplify. Now, this won't make your FPS go straight back up - you'll need to wait for newer versions of Mesa and such to be rolled out - but it's a start, especially if you don't already have 2.6.28.
From there, I'm sure you've seen this thread which outlines what to recompile. I'll probably wait though, since 100FPS is quite an upgrade for me - I didn't have hardware rendering until a month or so ago (I think) - and my system is slow enough as it is (it can't use DDR2 RAM) for me to really bother with fast graphics anyway.
-dav7 -
Cross column radio group solution using dynamically generated HTML
I am tasked with creating a screen in Apex matching look and feel of an existing application screen; tabular form, multiple column radio buttons to update a single column value (radio group needs to be row oriented, across multiple columns). I could not find a way to use HTMLDB_ITEM.RADIO_GROUP () function for this due to the radio group being column based, great as a row selector but not for use across columns (each button being a column).
My first thought was to comprise and use checkboxes via HTMLDB_ITEM.CHECKBOX () for the multiple choices (in each column) and HTMLDB_ITEM.HIDDEN() to hold the chosen value, a JavaScript function for “onClick” event to make the checkboxes in one row act like radio buttons in a radio group. I created a simple application to show the concepts of my solutions …
SQL looks like this:
select pk_id, -- f01
object_to_color, -- f02
HTMLDB_ITEM.CHECKBOX(11, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
HTMLDB_ITEM.CHECKBOX(12, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
HTMLDB_ITEM.CHECKBOX(13, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
color_choice -- f03
from objects_to_color
Columns pk_id and color_choice are set as Show off and Display As Hidden. Note that my HTMLDB_ITEM.CHECKBOX items start with id number 11 (f11 – f13) so as not to conflict with the item id’s Apex will generate on it’s own. I could have used HTMLDB_ITEM functions to create all items and had my own PL/Sql update process.
This creates a tabular presentation with a column for each color choice as a checkbox, shown checked if that color is initially set.
The JavaScript function chkboxAction() clears the other checkboxes if a color is selected and stores the color in the hidden item db column for use in Apex Submit processing. Sorry the identation get's lost in the post!
function chkboxAction (id, ckbx, color) {
// f01 is pk_id (hidden)
// f11 is RED checkbox
// f12 is BLUE checkbox
// f13 is GREEN checkbox
// f03 db column color_choice for update (hidden)
var idx;
// Find row index using pk_id passed in as id argument.
for (var i=0; i < document.wwv_flow.f01.length; i++) {
if (document.wwv_flow.f01.value == id) {
idx = i;
i = document.wwv_flow.f01.length;
if (ckbx(idx).checked == true) {
// Set hidden color_choice column value to be used in update.
document.wwv_flow.f03(idx).value = color;
// Uncheck them all, then reset the one chosen.
document.wwv_flow.f11(idx).checked = false;
document.wwv_flow.f12(idx).checked = false;
document.wwv_flow.f13(idx).checked = false;
ckbx(idx).checked = true;
} else {
// Unchecked so clear color_choice column value to be used in update.
document.wwv_flow.f03(idx).value = '';
This works well and, as an aside, has an added feature that the color can be “unchosen” by unchecking a checked checkbox and leaving all checkboxes unchecked. This cannot be done with radio buttons unless a radio button is added as “no color”.
But what if radio buttons must be used, as in my situation? Here is another solution using custom code to dynamically generate radio buttons for a row based radio group rather than using HTMLDB_ITEM.RADIO_GROUP ().
select pk_id, -- f01
object_to_color, -- f02
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
decode(color_choice, 'RED', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''RED'')">' red,
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
decode(color_choice, 'BLUE', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
decode(color_choice, 'GREEN', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
color_choice -- f03
from objects_to_color
The pk_id column is used here to ensure a unique name and unique id for the items. In practice a custom api should be used to generate items in this way.
The JavaScript function is actually simpler for radio buttons because the radio group handles the mutually exclusive logic for choosing a color.
function rbAction (id, color) {
// f01 is pk_id (hidden)
// f03 db column color_choice for update (hidden)
var idx;
// Find row index using evaluation_question_id.
for (var i=0; i < document.wwv_flow.f01.length; i++) {
if (document.wwv_flow.f01.value == id) {
idx = i;
i = document.wwv_flow.f01.length;
// Set hidden result column referenced in update.
document.wwv_flow.f03(idx).value = color;
Now the problem is that on update, Apex will be confused by the custom items and try to post updated values to it’s own internal items – which don’t exist. The result is the very frustrating HTTP 404 - File not found error when apex/wwv_flow.accept executes on Submit. So, the trick is to clear the custom items prior to the update with a simple JavaScript function, then the values show again when the page is rerendered, if you are not branching from the page. The Submit button is changed to call the following function:
function submit () {
var items = document.getElementsByTagName("INPUT");
for (i=0; i< items.length; i++) {
if (items(i).type == "radio") {
if (items(i).checked == true)
items(i).checked = false;
doSubmit('SUBMIT');
This technique might have general use when using custom items. Comments or improvements on this?
See Oracle Apex site: workspace SISK01, app OBJECTS_TO_COLORJust the code for formatting.
Checkboxes to behave like radio group ...
SQL ...
select pk_id, -- f01
object_to_color, -- f02
HTMLDB_ITEM.CHECKBOX(11, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f11, ''RED'')"', 'RED') red,
HTMLDB_ITEM.CHECKBOX(12, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f12, ''BLUE'')"', 'BLUE') blue,
HTMLDB_ITEM.CHECKBOX(13, color_choice,
'onClick="chkboxAction('||pk_id||', document.wwv_flow.f13, ''GREEN'')"', 'GREEN') green,
color_choice -- f03
from objects_to_colorJavaScript ...
function chkboxAction (id, ckbx, color) {
// f01 is pk_id (hidden)
// f11 is RED checkbox
// f12 is BLUE checkbox
// f13 is GREEN checkbox
// f03 db column color_choice for update (hidden)
var idx;
// Find row index using pk_id passed in as id argument.
for (var i=0; i < document.wwv_flow.f01.length; i++) {
if (document.wwv_flow.f01(i).value == id) {
idx = i;
i = document.wwv_flow.f01.length;
if (ckbx(idx).checked == true) {
// Set hidden color_choice column value to be used in update.
document.wwv_flow.f03(idx).value = color;
// Uncheck them all, then reset the one chosen.
document.wwv_flow.f11(idx).checked = false;
document.wwv_flow.f12(idx).checked = false;
document.wwv_flow.f13(idx).checked = false;
ckbx(idx).checked = true;
} else {
// Unchecked so clear color_choice column value to be used in update.
document.wwv_flow.f03(idx).value = '';
}Radio button solution ...
SQL ...
select pk_id, -- f01
object_to_color, -- f02
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_1" value="RED" '||
decode(color_choice, 'RED', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''RED'')">' red,
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_2" value="BLUE" '||
decode(color_choice, 'BLUE', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''BLUE'')">' blue,
'<input type="radio" name="rb'||pk_id||'" id="rb'||pk_id||'_3" value="GREEN" '||
decode(color_choice, 'GREEN', 'CHECKED', '')||
' onClick="rbAction('||pk_id||', ''GREEN'')">' green,
color_choice -- f03
from objects_to_colorJavaScript ...
function rbAction (id, color) {
// f01 is pk_id (hidden)
// f03 db column color_choice for update (hidden)
var idx;
// Find row index using evaluation_question_id.
for (var i=0; i < document.wwv_flow.f01.length; i++) {
if (document.wwv_flow.f01(i).value == id) {
idx = i;
i = document.wwv_flow.f01.length;
// Set hidden result column referenced in update.
document.wwv_flow.f03(idx).value = color;
function submit () {
// Clears radio buttons to prevent Apex trying to post and causing page error.
var items = document.getElementsByTagName("INPUT");
for (i=0; i< items.length; i++) {
if (items(i).type == "radio") {
if (items(i).checked == true)
items(i).checked = false;
doSubmit('SUBMIT');
} -
Problem in Setting Focus, on a dynamically generated field
Hi all,
I am having a jsp page, in which I have dynamically generated n number of input text fields, and with the function onchange="chk();", and i am passing the current text field value, and 2 more parameters min and max.
In function chk(), i am validating the input value by condition it should be within min and max..
my problem is i want to[b] get back the focus to the input text box, where the input is entered and not satisfied my condtion
function chk(a,b,c) / /a is my i/p, b and c are min and max values
if( (parseInt(a)>=parseInt(b)) && (parseInt(a)<=parseInt(c)) )
document.form1.submit;
return true
else
alert("Invalid Output");
var element=event.srcElement.name;
alert(element); // I am able to get the name of input text box
alert(event.srcElement.tagName); // this gives INPUT
if(event.srcElement.tagName=='INPUT')
alert("yes"); // i can get this alert
event.srcElement.focus(); // the focus can't be set back to that input field or element
return false
}try this and say me if it works fine!!!
<html>
<head>
<script>
function fileds() {
var myParent = document.getElementById('myDiv');
var text = document.createElement('input');
text.setAttribute('id', 'myText');
myParent.appendChild(text);
document.all.myText.focus();
</script>
</head>
<body>
<input type="button" onClick="javascript:fileds()" value="Create And Give Focus">
<br>
<div id="myDiv"></div>
</body>
</html>
bye -
Dynamically generating file names for 2 File ( 1: 2 mapping transformation)
Hi ,
I have a scenario Proxy to File(FCC) with 1:2 transformation in message mapping ie 1 sender and 2 receiver interface ....
1 Message mapping
1 Operation mapping
1 RD , 1 ID and 2 file receiver channels and 2 receiver agreements.
I need to dynamically generate the filename say abc.(first 9 characters of mesg id) and xyz.(first 9 characters of mesg id)
I used dynamic configurations with ASMA settings, created 2 UDF assigned each of these to header node of r receiver message types.
Here, I guess the second dynamic configuration is over writing the first dynamic configuration and hence creating only one file with xyz.(first 9 characters of mesg id)
name .
Need your valuable inputs
Thanks and regards,
PavithraAs dynamic configuration doesnot work in case of 1:n mapping what you need to do is
Create a field Filename in your source data structure
Create a1:1 mapping between your source structure and source structure
In that 1:1 mapping on the target structure assign UDF for file name
Now this target structure will be used as a source structure in your next 1:2 mapping
Under operation mapping add first the 1:1 mapping for source and then the multimapping
regards
Ninad -
Generating input textfields on clicking image with adf
Is it possible to generate input text fields dynamically on clicking a image with adf??
The functionality to add and remove text field from UI with ADF??
Edited by: 897462 on Nov 16, 2011 12:16 AMthanks for ur reply....my other question is
Is it possible to generate input text fields dynamically on clicking a image with adf??
The functionality to add and remove text field from UI with ADF?? -
Dynamically generating classes (is it possible?)
Hello.
I am trying to dynamically generate classes in java. is this possible. What i mean is, say I have a string "HelloBean" that is read from a file (a configuration file say). Is it possible to generate an instance of the class HelloBean somehow? Has this been tried before? can this be done? Any input and suggestions on this would be very helpful.
Thanks
VPIf I understand your question, you want to do something like this:
Object yourObject = Class.forName("HelloBean").newInstance();Have a look at the reflection API and the reflection tutorial. -
How to get the co-ordinates of a dynamically created input field
Hello Frn's
i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
as i am thinking ...i should first of all get info about the co-ordinates of dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of text View .
Please suggest your thoughts .
Thanks and Regards
Priyank DixitHi,
There is no provision in WD for getting screen coordinates and then placing the UI element.
You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
still,For dynamic creation you can refer to following wiki:
http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
regards
Manas Dua -
Need to display COlumn headers dynamically in ALG Grid
Hello,
I need to display column headers dynamically in alv grid Display with its corresponding value.
Column headers should be picked from a field in Final Internal table and its corresponding field will also need to pick from the same table.
T_final... Suppose Field STCTS - (To pick coulmn headers)
CCNGN - (To pick appropriate value for that column)
Can anybody explain me how i can pass these values to ALV Grid using
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = Y_I_FCAT
IMPORTING
EP_TABLE = DY_TABLE.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Any suggestions will be appreciated....
Regards,
KittuHi,
Go thru this link, and the code of Mr.Dev Parbutteea
Re: Probelm with Using Field Symbol in FM
thanks
Mahesh -
Help needed, Createing Dynamic User input
Hello,
I am attempting to create some dynamic user input by "predicting" what the user requires in a text box.
For example if the user enters "Smi" I have a select list pop up which gives the user all options that begin with "Smi".
I am able to achieve the popups but the interface is quite jerky and not terribly responsive I am trying to solve this by using a thread which starts and stops when new input is received but it is still not quite right.
The program uses a Sorted TreeSet to hold the data (I thought this would give me a quick search time) and a simple interface at this stage.
Any help would be fantastic
Thanks in advance :P
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
/** This program represents part of a larger user interface for allowing the
user to select data from a file or database.
<p>
When the program starts up, it will read in data from a given file, and hold
it in some type of container allowing rapid access.
<p>
The user may then type in the first few letters of the surname of a person,
and this program should immediately present in a popup dialog the names which
match. The user will be able to click on one of the names in the popup and
that will cause all data about that person to be displayed in the JTextArea
at the bottom of the window.
<p>
This program requires the FormLayout.class, FormLayout$Placement.class, and
FormLayout$Constraint.class files in the same directory
(folder) or in its classpath. These is provided separately.
class PartMatch extends JFrame implements Runnable
/** Close down the program. */
JButton quitbtn;
/** Field for the surname. */
JTextField namefld;
/** Full details of the person(s). */
JTextArea results;
/** Popup dialog to display the names and addresses which
match the leading characters given in namefld. */
Chooser matches;
/** Default background color for a window. */
final static Color defBackground = new Color(0xD0C0C0);
/** Default foreground color for a window. */
final static Color defForeground = new Color(0x000000);
/** Default background color for a field */
final static Color fldBackground = new Color(0xFFFFFF);
/** Default background color for a button */
final static Color btnBackground = new Color(0xF0E0E0);
final static Color dkBackground = new Color(0xB0A0A0);
/** Larger font */
final static Font bold = new Font("Helvetica", Font.BOLD, 30);
TreeSet members;
String input;
String[] found;
public static void main(String arg[])
UIManager.put("TextField.background",fldBackground);
UIManager.put("TextField.foreground",defForeground);
UIManager.put("TextField.selectionBackground",btnBackground);
UIManager.put("TextArea.background",fldBackground);
UIManager.put("TextArea.foreground",defForeground);
UIManager.put("TextArea.selectionBackground",btnBackground);
UIManager.put("Panel.background",defBackground);
UIManager.put("Label.background",defBackground);
UIManager.put("Label.foreground",defForeground);
UIManager.put("Button.background",btnBackground);
UIManager.put("Button.foreground",defForeground);
UIManager.put("CheckBox.background",defBackground);
UIManager.put("ScrollBar.background",defBackground);
UIManager.put("ScrollBar.thumb",btnBackground);
UIManager.put("ComboBox.background",btnBackground);
UIManager.put("ComboBox.selectionBackground",dkBackground);
PartMatch trial = new PartMatch(arg);
public PartMatch( String [] arg )
super("Part Match");
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container cpane = getContentPane();
FormLayout form = new FormLayout(cpane);
JLabel lab1 = new JLabel("Fetch details") ;
lab1.setFont( bold );
form.setTopAnchor( lab1, 4 );
form.setLeftAnchor( lab1, 4 );
JLabel lab2 = new JLabel("Surname: ") ;
form.setTopRelative( lab2, lab1, 4 );
form.setLeftAlign( lab2, lab1 );
namefld = new JTextField( 30 );
form.setBottomAlign( namefld, lab2 );
form.setLeftRelative( namefld, lab2, 4 );
namefld.addCaretListener( new CaretListener()
public void caretUpdate(CaretEvent e)
showMatches();
quitbtn = new JButton( "Quit" );
quitbtn.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent e)
quitProcessing();
form.setBottomAlign( quitbtn, namefld );
form.setLeftRelative( quitbtn, namefld, 15 );
results = new JTextArea( 10,50 );
results.setEditable(false);
JScrollPane jsp = new JScrollPane( results,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
form.setTopRelative( jsp, lab2, 6 );
form.setLeftAlign( jsp, lab2 );
form.setBottomAnchor( jsp, 5 );
form.setRightAnchor( jsp, 5 );
form.setRightAnchor( quitbtn, 5 );
matches = new Chooser( this );
//matches.setUndecorated(true);
pack();
setVisible(true);
namefld.requestFocus();
if (arg.length > 0) init(arg[0]);
else init("triathlon.txt"); //<<<<<<<<<<<<<<<< Place the default filename here
/** Called once only, at the end of the constructor, to read the data
* from the membership file.
public void init( String fname )
members = new TreeSet();
try {
FileReader fr = new FileReader(new File (fname));
Scanner scan = new Scanner(fr);
trimember cmem;
String cLine, eTag, memberNo, first, last, gender, yob, tel ,addr,
club;
while(scan.hasNextLine())
cLine = scan.nextLine();
Scanner scan2 = new Scanner(cLine);
scan2.useDelimiter(";");
eTag = scan2.next().trim();
memberNo = scan2.next().trim();
first = scan2.next().trim();
last = scan2.next().trim();
gender = scan2.next().trim();
yob = scan2.next().trim();
tel = scan2.next().trim();
addr = scan2.next().trim();
club = scan2.next().trim();
cmem = new trimember(eTag, memberNo, first, last, gender, yob,
tel, addr, club);
members.add(cmem);
catch (FileNotFoundException ex)
results.append("Sorry can't find the input file\n");
results.append("Please check file name and location and try again");
ex.printStackTrace();
/** Called every time there is a change in the contents of the text field
* namefld. It will first clear the text area. It then needs to search
* through the container of data to find all records where the surname
* starts with the characters that have been typed. The names and
* addresses need to be set up as strings and placed in
* an array of Strings. This can be placed in the "matches" window and
* displayed for the user, inviting one to be selected.
* <p>
* The performance of this is very important. If necessary, it may be
* necessary to run as a separate thread so that the user interface is
* not delayed. It is essential that the user be able to type letters at a
* reasonable speed and not have the keystroke processing held up by
* previous text.
public void showMatches( )
run();
// First clear the text area
//results.setText("");
// Determine the leading characters of the surname that is wanted
input = namefld.getText();
// Locate the data for this name, and display each matching item
// in the JTextArea ...
// Example of how to set the data in the popup dialog
matches.list.setListData(found);
matches.pack(); // resize the popup
// set the location of the popup if it is not currently visible
if ( ! matches.isVisible())
Dimension sz = matches.getSize();
Point mouse = getMousePosition();
Point framepos = getLocation();
int x=0, y=0;
if (mouse == null)
Point pt = results.getLocation();
x = pt.x + 20 + framepos.x;
y = pt.y + 20 + framepos.y;
else
x = mouse.x - 2 + framepos.x;
y = mouse.y - 2 + framepos.y;
matches.setLocation(x,y);
matches.setVisible(true);
namefld.requestFocus();
/** Perform any final processing before closing down.
public void quitProcessing( )
// Any closing work. Then
System.exit(0);
public void run()
ArrayList<String> foundit = new ArrayList<String>();
System.out.println(input);
if(input != null)
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.startsWith(input))
foundit.add(test.last +", "+ test.first);
found = new String[foundit.size()];
for(int i=0; i<foundit.size();i++)
found[i] = foundit.get(i);
/** A window for displaying names and addresses from the data set which
match the leading characters in namefld.
<p>
This will automatically pop down if the user moves the mouse out of the
window.
<p>
It needs code added to it to respond to the user clicking on an item in
the displayed list. */
class Chooser extends JWindow
/** To display a set of names and addresses that match the leading
characters of the namefld text field. */
public JList list = new JList();
Chooser( JFrame parent )
super( parent );
Container cpane = getContentPane();
cpane.addMouseListener( new MouseAdapter()
public void mouseExited(MouseEvent e)
Chooser.this.setVisible(false);
cpane.add("Center",list);
list.addListSelectionListener( new ListSelectionListener()
public void valueChanged(ListSelectionEvent e)
Chooser.this.setVisible(false);
System.out.println("ValueChanged");
// First clear the text area
results.setText("");
String in = (String) list.getSelectedValue();
System.out.println("Selected Value was : "+in);
String[] inlf = in.split(", ");
System.out.println("inlf[0]:"+inlf[0]+" inlf[1]:"+inlf[1]);
results.append("Surname \tFirst \teTag \tMemberNo \tSex \tYOB " +
"\tTel \tAddress \t\t\tClub\n");
Iterator it = members.iterator();
while(it.hasNext())
trimember test = (trimember) it.next();
if (test.last.equals(inlf[0])&&test.first.equals(inlf[1]))
results.append(test.toString()+"\n");
namefld.requestFocus();
public class trimember implements Comparable
String eTag;
public String memberNo;
public String first;
public String last;
String gender;
String yob;
String tel;
String addr;
String club;
public trimember(String eT, String me, String fi, String la,
String ge, String yo, String te, String ad, String cl)
eTag = eT;
memberNo = me;
first = fi;
last = la;
gender = ge;
yob = yo;
tel = te;
addr = ad;
club = cl;
//To String method to output string of details
public String toString()
return last + "\t" + first + "\t" + eTag + "\t" +
memberNo + "\t" + gender + "\t" + yob + "\t"+ tel + "\t" +
addr + "\t" + club;
//Compare and sort on Last name
public int compareTo(Object o)
trimember com = (trimember) o;
int lastCmp = last.compareTo(com.last);
int firstCmp = first.compareTo(com.first);
int memCmp = memberNo.compareTo(com.memberNo);
if (lastCmp == 0 && firstCmp !=0)return firstCmp;
else if (lastCmp==0&&firstCmp==0)return memCmp;
else return lastCmp;
}Please don't cross-post. It is considered very rude to do that here:
http://forum.java.sun.com/thread.jspa?messageID=9953193
Maybe you are looking for
-
Pick up Files based on Timestamp???.
HI All, Is it possible to pick up the files in the order of which they are put in a shared folder ?. Our client system will put the xml files in a shared folder with timestamps..PI will pick these files one by one..but if the PI server is down.. the
-
Hii Experts, I got a requirement where in a particular PO when a user enters delivery date say after 10days from now a popup should *** after 10 days informing the user to follow up with the vendor for that particular PO. Can a anyone suggest how
-
How do I remove all apps from my iPhone?
How do I bulk remove all apps from my iPhone? There has to be a better way than removing each one manually. Thanks.
-
I just bought an IPhone 4s and plugged it into my Toshiba Windows 7 (64 bit) OS and it failed to recognize the phone. I checked in the tech community and discovered that I need to remove all the software assoicated with the phone and start over....I
-
Slow on authentication windows
My work 15" MacBook Pro (2.3 GHz i7) running 10.8.5 has a strange problem that I have not been able to figure out why it's happening. When I am away from work, my MB Pro is very slow on any sort of OS X authentication: - Password prompt when deactiva