Javascript with dropdown lists
good morning everyone,
I'm playing around today with JavaScript code to add an "item" to my dropdown list if a certain condition is met.
The code seams to work if preview mode, but when I go back to designer mode and preview again, the item isn't really saved as an item of that dropdown list object, what am I doing wrong here?
Here is code:
If (d2 > tmpAprildate){
xfa.host.messageBox("its greater then April 1st.");
//add to dropdown list
DropDownList1.addItem(curfy);
}else{
//do nothing
so I can see it being added to my drop list just by looking into it. But if I leave and come back, it needs to be added again as it didn't really save it
Thank you very much for your help again with this
Patrick
thanks guys,
I now have something i can work with. I modified code to be set in the initialize phase so that i populate those with new data at that point.
My Fiscal year field now works
Similar Messages
-
Problem with DropDown List and ValueChange
Hi,
I have the following problem (I use NetBeans 6.1): I have a page, made with the Visual Web Designer, where there is a DropDown List component. The expected behaviour is once I select an item from the dropdown list, something (depending on the item I clicked) appears or happens (so, without any submit button or action link).
This is the code I have at the moment:
JSP (Pagina1.jsp):
<h:selectOneMenu binding="#{Pagina1.dataTypeDropDown}" id="dataTypeDropDown" immediate="true" onchange="return getSearchFields(this);" style="height: 24px; left: 192px; top: 24px; position: absolute; width: 744px" valueChangeListener="#{Pagina1.dataTypeDropDown_processValueChange}">
<f:selectItems binding="#{Pagina1.dropdown1SelectItems}" id="dropdown1SelectItems" value="#{Pagina1.dropdown1DefaultItems}"/>
</h:selectOneMenu>
Bean (Pagina1.java):
public void dataTypeDropDown_processValueChange(ValueChangeEvent vce)
String selectedValue = (String)vce.getNewValue();
System.out.println(selectedValue); // nothing happens!
System.out.println("Hello"); // nothing happens!
[...]My problem is that, whenever I select an item form the dropdown list, ehm... nothing happens.
What could I do? Isn't that a kind of "change of value"? JavaScript events work fine, but no way with the ValueChange.
And please consider that I'd like to obtain the same result with both Standard Components and Woodstock Components.
Any help would be greatly appreciated!
Thanks!try adding "*this.form.submit();*" to your on change attribute of select menu.
Your on change will look like onchange="return getSearchFields(this);this.form.submit();"
This should work. -
Error/fault when using reader and digitial signatures combined with dropdown list
I'm working on a time card form for my company and they want me to have the form calculate the dates for the two week pay period when the ending day of the pay period is selected, that part I have down through code. The problem I am running into though is that when the user is using Adobe reader to digitally sign and send the file to their supervisor the file is changing the selection date field back to the first selection in the drop down list after the first digital signature is applied and the file saved. This error does not occur when the user is utilizing Adobe Pro though. Does anyone have any ideas? I'm wondering if it is something to do with the dropdown list settings or some kind of locking feature not working properly with the reader version. I am editing/creating the form through LiveCycle Designer ES4.
Hi,
The drop down list box, by default will have a blank value. If you can declare that as obligatory then the report will force the user to enter the value in it.
Regards,
Ravi
Note : Please mark the helpful answers -
Is it possible to create the ALV output with dropdown list for the columns
Hi forum experts,
Could the ALV output contain the dropdown list for the column names? if yes, then how we can acheive this to happen.
Thanks in advance,
Regards,
Samad.
Edited by: Samad arif on Aug 21, 2009 4:40 PMHi Arif,
Yes we can .FOr the codding check the article,
[dropdowns in ALV|https://wiki.sdn.sap.com/wiki/display/Snippets/DropdownsinALV]
regards,
Archana
Edited by: Archana Kumari on Aug 21, 2009 1:22 PM -
Form with dropdown lists using external XML data - Distribution
Hi all,
I have created a form which has a series of drop down lists that populate dynamically from an external XML file. The option selected in the first list determines what data can be selected in the second, and so on.
This functionality worked well within designer when I previewed the form - the problem I have is when I go to distribute. I (perhaps mistakenly) assumed that when I distributed the form, the external XML file would be absorbed into the main PDF, but this as not the case. Not only that, even if the XML file is in the same location as the published PDF, the dropdowns no longer populate with any data.
Am I doing something wrong? Is there a setting to draw in external XML when a form is published? Is there another method to dynamically populate dropdowns that will provide me with a single PDF as a final product?
Cheers,
Lachlan.Hello Lachlan,
Before distributing the form have you opened that form in Acrobat and imported the XML and saved it ?
Thanks.
Bibhu. -
"Open With" dropdown list duplicates
I tried doing a Migration from one of my Macbook Pro laptops to another using the FWTDM method and after completion, the source laptop now has a weird glitch that I can not figure out how to fix. I thought that nothing would change on the source laptop so this is very odd to me.
When I use the "Open With" list on any file all of the Apps are now duplicated. Such Photoshop CS2 displaying twice and Acrobat Displaying twice. The application fold is in tact and does not contain duplicates though.
I have tried running the disk verif and repair utilities for permissions.
Anyone encountered this problem and know how to fix it?
Thanks.Open the Terminal application in your Utilities folder. Copy and paste the following line after the prompt and press return.
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/L aunchServices.framework/Versions/Current/Support/lsregister -kill -r -domain system -domain local -domain user
If you're averse to using the Terminal then download the shareware utility TinkerTool System. Click on the User icon in the toolbar, then click on the Launch Services tab. Click on the Rebuild Database button.
Why reward points?(Quoted from Discussions Terms of Use.)
The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values. -
No options but PS CC in Bridge's open with dropdown list
Just downloaded Photoshop CC with Photoshop CS6 still installed on my computer. Why working in Bridge I noticed that when right clicking on an image and then the "Open With" link, the only thing showing up is Photoshop CC. It would be nice if CS6 was an option as well. Is there any way to set it so that both are available?
Also, how do I install my Neat Image plug-in in Photoshop CC?
Thanks
LindaI just closed out CC and opened CS6 and CC is still showing in the open with drop down. I also closed/re-opened Bridge and this did not help.
I also want to mention that I did not download Bridge CC, so I am still using Bridge CS6. -
How to filter XML Datasource bound to Dropdown list?
Dear All,
I quiet new to LiveCycle designer ES from past couple of weeks I am working on this.
Right Now I have issue with filering XML Datasource bound with dropdown list.
I have XML file which has the data to the States and City. I have bound one of my dropdown list to State. My requirement is once I select the 'State' the corresponding City Names has to be listed in the second dropdown list.
I searched in the net and got couple of samples on that. But I failed to make my form work as requirement. Even though I have generated the XML file as given structure in the examples.
Please check the attached xml file which I have created.
I have struckup right now. So, help me this.
Very much thanks in advance.
Regards,
Sree Harshavardhana.Dear BR,
Thanks for the quick reply and most useful example. I'll try to apply the same in to my form and look in to it.
But, I would like to know is what was the corrections you have made in the javascript. I am not wrong the code which you have written in the example pdf the same I had written, but it did not work for me! Please check the code below which I had written.
StatesAndCities.#subform[0].StateName::change - (JavaScript, client)
var stateDataNode = xfa.resolveNode("StatesAndCities.States.(StateID.value == " + this.boundItem(xfa.event.change) + ")");
CityName.clearItems();
for (var i=0; i<stateDataNode.City.all.length; i++)
xfa.host.messageBox(stateDataNode.Cities.all.item(i).Code.value);
CityName.addItem(staffDataNode.City.all.item(i).Code.value);
I'll look forward by highlighting my mistakes, so that I can go by my own.
Regards,
Sree Harshavardhana. -
Visual JSf: textField hide or disable, when selecting dropDown list
Hello everyone,
I am new to this forum, I am working on Visaul JSF, I have a question,
When i select a value dropDown List, i want to disable or hide textField depending on the selected item in the list.
I have put javascript for dropDown list. I am not able to do this. Can any one help me please...
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>for downdown, i have added this..
onChange="fun(this)"In dropdon list
name value
One 1
Two 2
Three 3
Jsp code:
<jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<webuijsf:page id="page1">
<webuijsf:html id="html1">
<webuijsf:script/>
<webuijsf:script>
function fun(sel){
var state = sel.options[sel.selectedIndex].value * 1;
alert(state);
if(state == 2){ alert("if"); document.getElementById('form1:textField2').disabled='true' }else{ alert("else"); document.getElementById('form1:textField2').disabled='false'}
</webuijsf:script>
<webuijsf:head id="head1">
<webuijsf:link id="link1" url="/resources/stylesheet.css"/>
</webuijsf:head>
<webuijsf:body id="body1" style="-rave-layout: grid">
<webuijsf:form id="form1">
<webuijsf:textField id="textField2" onChange="" style="height: 18px; left: 174px; top: 258px; position: absolute; width: 216px"/>
<webuijsf:button id="button1" onClick="return fun()" style="position: absolute; left: 228px; top: 324px" text="Button"/>
<webuijsf:dropDown id="dropDown1" items="#{Page3.dropDown1DefaultOptions.options}" style="position: absolute; left: 312px; top: 90px" onChange="fun(this)"/>
</webuijsf:form>
</webuijsf:body>
</webuijsf:html>
</webuijsf:page>
</f:view>
</jsp:root>Thanks in advance
Neha
Edited by: Neha_540 on Apr 5, 2009 11:02 PM
Edited by: Neha_540 on Apr 5, 2009 11:05 PMHi Neha,
Hope this helps.
function changeMarital()
var marital = document.getElementById('form1:drpMarital_list').value;
if(marital == "Others")
document.getElementById('form1:lblOtherMarital').style.display='';
document.getElementById('form1:txtOtherMarital').style.display='';
else
document.getElementById('form1:lblOtherMarital').style.display='none';
document.getElementById('form1:txtOtherMarital').style.display='none';
} -
Dropdown list in infotype table control
Hello,
I am creating a custom HR infotype with dropdown list field. This field holds a key but displays a text from text table. Dropdowns contents are dependant on Start Date of the infotype record and I am using PBO module to fetch this data. Everything works fine except one detail. Infotype has automatically generated overview table control, which holds various data including Start Date of infotype record and the dropdown field in question. And even that would work well if not for the date, in case when I drop the date check dropdowns in all rows get populated. Currently it seems to only use the date on the last row of the table control and subsequently fails to correctly populate dropdowns in all other rows. With no access to SAP code which populates table control, how do I get the date for each individual row?
Best regards, ArminsHi Marty,
For this you have to create 2 nodes
1. A node which will be bound to the table. This will be a singleton node.
2. A node for dropdown. This node should be inside the table node and should be a non-singleton one.
Check the singleton properties of both the nodes above.
Whenever you will create an element for table node, an instance of the dropdown node will be automatically created.
To set the value in this dropdown at leadselection, you can use the below logic
1. Assume you know the value of the fruit to be set in the dropdown
2. for(int i = 0; i < wdContext.nodeFruit().size(); i++)
if( wdContext.currentTableNode().nodeFruit().getFruitElementAt(i).getFruit().equals(fruitName) )
wdContext.currentTableNode().nodeFruit().setLeadSelection(i);
break;
Hope this helps you. -
Unable to add items to dropdown list using javascript
Hi,
I'm trying to add additional items to a dropdown list at runtime using javascript.
I'm doing this by invoking the addItem method on the dropdown list field during its initialize event.
However when I run the generated pdf in Acrobat Pro, I get the following error in the console -
GeneralError: Operation failed.
XFAObject.addItem:3:XFA:form1[0]:#subform[0]:field0[0]:initialize
Method: 'addItem' cannot be called because doing so would violate this document's permissions settings.
The pdf form has no signatures or any other stuff in it.
What additional permissions do I need to add and how ?
You can view the pdf here -
https://dl.dropboxusercontent.com/u/8022836/xfa3_test.pdf
Thanks,
JoelIs there a reason to use the code you did? It looks like the problem is with the variable's permissions when going through the template.
This code works just fine in that same event:
this.addItem("new item");
As does:
var f = xfa.resolveNode("form1.#subform1[0].field0");
f.additem("new item"); -
How Do i create a list that will show in a dropdown box with the list being pulled from another tab and not the cell data format junk?
I currently run OS X 10.10.1
Now i have been trying to work on this for a while now and what i want to do should be simple but its apparently not.
Here is an example of what i want to happen.
I will have 2 tabs: Contact | Sales
Now Contacts will have the list of names and various information about a customer, While Sales will have one drop-down box for each Cell Row that will show the names of the person in tab contacts
for what i am wanting to do i cant use the data format pop-up menu because the list is edited everyday several times a day.
Now how do i do this, Excel can do this so how can numbers do it?Hi Shegra,
Paste this into a applescript editor window and run it from there. In the script you may need to adjust the four properties to agree with your spreadsheet. Let me know if you have any questions.
quinn
Script starts:
-- This script converts column A in one table into an alphabetized list of popups. It copies the last cell in that column. Then reverts the column to text. It then refreshes popups in column A of a data table starting with a user defined row.
property DataEntrySheet : "Sheet 1" --name of sheet with popups to be refreshed
property DataEntryTable : "Sales" --name of table with popups to be refreshed
set copyRange to {}
property PopValueSheet : "Sheet 1" --name of sheet with popup values table
property PopValueTable : "Contacts" --name of table with popup values
set PopStartRow to {}
tell application "Numbers"
set d to front document
set ps to d's sheet PopValueSheet
set pt to ps's table PopValueTable
set s to d's sheet DataEntrySheet
set t to s's table DataEntryTable
set tf to t's filtered --this records filter setting on data Entry Table
display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row
set PopStartRow to {text returned of result}
tell pt --convert list to alphabetized popups
set ptRows to count rows
set copyRange to ("A2:" & name of cell ptRows of column "A")
set selection range to range copyRange
set selection range's format to text
sort by column 1 direction ascending
set selection range's format to pop up menu
-- popupsmade
set selection range to cell ptRows of column 1 of pt
set v to value of cell ptRows of pt
end tell
activate application "Numbers"
tell application "System Events" to keystroke "c" using command down
tell pt
set selection range to range copyRange
set selection range's format to text
end tell
tell t
set filtered to false
set tRows to count rows
set pasteRange to ((name of cell PopStartRow of column "A") & ":" & (name of cell tRows of column "A"))
set selection range to range pasteRange
tell application "System Events" to keystroke "v" using command down
set filtered to tf
end tell
end tell -
Populating dropdown list with entries in multiple text boxes?
I'm creating a form that needs to be simple to use and complete. I would like to be able to populate a drop-down list with entries the user puts into text boxes. Can this be done?
For more detail:
In one location is a table, the use will type into a text box a Project Name, then other information such as location and total acres.
In another location I've got a table where the user will enter the offerings from each project they listed in the 1st table. It is a long table as it is, I cannot combine the two (will not fit on one page if I do combine them).
Instead of making the user type in the project names multiple times, I'd like to be able to take the project names the users input (from table one) and have those entries automatically populate the dropdown list in the second table.
Any suggestions would be greatly appreciated!!!Not exactly a find and replace but you can do it.
Select the text frames yu want to change the colors using the shift key to click select the frames.
Then go to Edit>Edit Color>Recolor Art
You wll see a dialog with red and black bars along side two shorter bars click the shorter bars to select a New Color a color picker will appear you can use the swatches or the color mixer.
There is a live preview /so you will see the change in case you want to pick a different gray, of course you can always go back to the recolor art dialog.
I am afraid you manually have to select text frames with multiple colors in order to accomplish what you want but the method above I believe is the only want to change the colors.
This video shows how the dialog works but pretend the one frame I did not select is another color.
http://www.wadezimmerman.com/videos/RecolorText.mov -
Problem in mapping dropdown list values with the queries
hi,
I am building a simple applicaittion of currency conversion.
The scenario :
I have a input form with a dropdown list and a input field to enter the amount
I have created the drop down list with the respective details
Value Desc
1 dollarToeuro
2 euroTodollar
when the user selects the first option in the drop down list and then enters the value and gives a submit -> the conversion takes place
but evrytime i select the second option --> the application hangs..
i have given a guard condition in the submit action for each if the query as LIKE(@option,"1") OR LIKE(@option,"2") for the respective queries.
Please can someone tell me where i am going wrong???
Regards,
VaishaliHi ,
what is the need of ur gaurd condition there?
and try to run the model without that guard condition.
Regards,
Govindu -
Select distinct using LINQ and bound to a dropdown list with id and display name
Hi,
On one of my sharepoint page, I want to populate dropdown list with countries, namely
<asp:DropDownList ID="ddlCountry" runat ="server"></asp:DropDownList>
In the code, I use LINQ:
var country = (from p in dc.ProvCountries
select p.country_code ).Distinct();
ddlCountry.DataSource = country;
ddlCountry.DataBind();
I want the country_code to be the ID, while the country_name will be the display name in the dropdown, how can that be done?
Thanks in advance.Hi,
The following code for your check.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplicationLib
public partial class _Default : Page
protected void Page_Load(object sender, EventArgs e)
List<ProvCountries> list = new List<ProvCountries>();
list.Add(new ProvCountries { country_code = "201", country_name = "A"});
list.Add(new ProvCountries { country_code = "201", country_name = "B" });
list.Add(new ProvCountries { country_code = "202", country_name = "C" });
list.Add(new ProvCountries { country_code = "202", country_name = "D" });
var country = (from p in list select new { p.country_code, p.country_name }).DistinctBy(p => p.country_code).ToList();
ddlCountry.DataSource = country;
ddlCountry.DataValueField = "country_code";
ddlCountry.DataTextField = "country_name";
ddlCountry.DataBind();
ddlCountry.Items.Insert(0, new ListItem("Please select", ""));
class ProvCountries
public string country_code { get; set; }
public string country_name { get; set; }
static class DataDistinct
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
HashSet<TKey> seenKeys = new HashSet<TKey>();
foreach (TSource element in source)
if (seenKeys.Add(keySelector(element)))
yield return element;
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Dennis Guo
TechNet Community Support
Maybe you are looking for
-
Displaying English characters on a Japanese locale
The application I am working is localized for Enlish and Japanese. I need to bring up the application in English on a Japanese locale ( OS ). I tried to use the command line parameters -DLocale.language en -DLocale.country US. Even then, I am not abl
-
Blue boxes for images in new Stationary
When I create a new mail message and save it as stationary all the stationary has in it is the text and blue boxes with question marks for all the images? What am I doing wrong?
-
What does it mean by "Deprecation of MBeanHome and Type-Safe Interfaces" ?
The "Javadoc" for the type safe WebLogic MBean interfaces have this disclaimer; Deprecation of MBeanHome and Type-Safe Interfaces... This is a type-safe interface for a WebLogic Server MBean, which you can import into your client classes and access t
-
Can a URL being loaded have a variable in its address?
in plain english, i'd like to do the following: xmlLoader.load(new URLRequest("http://www.mysite.com/whatever/whatever/(thirdSegment)")); where (thirdSegment) is the third segment of whatever URL the current swf file is on. I aready define segment 3
-
Printing records that count more than 1 based of 3 fields.
Hi: I have this table below. I want to print list of USERIDs that have different USERID, SHORTNAME and COMPANY combination. One of the USERID I want to print below is jkova since there are two records for jkova that have different COMPANY and SHORTNA