How to get Select menu to determine next set of (hidden) inputs?
Operating System: Mac OSX 10.6
Software: Dreamweaver CS4, with local testing environment.
The website i am currently creating uses form based quotes, (for a printing business).
See here, http://www.barringtonprint.com/perfect/quote-continuous.html for the current webpage i am working on.
I want to use a select menu to determine how many 'parts' the user requires, and for it to then display the necessary text fields for them to fill in.
At the monent the form just has the maximun amount (7) already on the form, and just requires the user to leave the non-required fields empty.
However i would like the form to just have inputs for the first 'part' (Part 1), with a select menu that gives the user the option to select more than 1 'part' and then display how many more rows of text fields are needed depending on the outcome of the select menu.
I presume i will need to use javascript to do this but i am unsure on how to proceed.
NOTE: these are old forms that i have inherited and do use tables, im aware this is not the best way to proceed, however im sticking with them for now.
Any help will be much appreciated, as this is driving me nuts.
Andrew Barrington
I'm sure there are cleaner ways of doing this, but I already had this put together from another project. Hopefully it will get you started.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Form with jQuery Validation</title>
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--JQUERY LATEST-->
<script src="http://code.jquery.com/jquery-latest.min.js">
</script>
<!--JQUERY VALIDATE-->
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js">
</script>
<style>
/**BEGIN FORM STYLES**/
#contact {
font-size: 14px;
width:800px; /**adjust width in % or px as needed*/
margin: 0 auto; /**adjust margins as needed*/
background: #FFF;
border: 2px groove #999;
padding: 2%;
#contact fieldset {
margin-bottom:5px;
background:#CCC;
#contact legend {
padding: 8px;
background: #000;
font-weight: bold;
color: #FFF;
line-height: 1.5;
/**wrap form lables and fields inside ordered lists for better web accessibility**/
#contact ol {
list-style:none;
margin:0;
padding:0}
#contact li {
padding:5px;
margin: 0;
clear: left;
#contact label{
display:inline-block;
float:left;
line-height: 23px; /**lines up labels with fields**/
width:15%;
font-size: 12px;
text-align:right;
margin-right: 10px; /*space between labels, fields*/
#contact textarea,
#contact input[type=text],
#contact input[type=email],
#contact input[type=number] {
width: 45%; /**same width on fields**/
padding: 5px;
color:#333;
font-family:Arial, Helvetica, sans-serif;
font-size: 12px;
#contact select {width:46.5%}
/**field background on focus**/
#contact input:focus,
#contact input:active,
#contact textarea:focus,
#contact textarea:active,
#contact select:focus,
#contact select:active
{background-color: #FFC;}
#contact label.error {
line-height:1;
color:#F00;
background:#FFC;
padding:3px;
box-shadow:1px 2px 3px #333
/**hidden ids based on selection**/
#one,#two,#three,#four {
color: #03C;
font-weight:bold;
display:none;
</style>
</head>
<body>
<p>Conditional Form with jQuery Validation</p>
<!--begin form-->
<form id="contact" action="path/form-processing-script.php" method="post">
<fieldset>
<legend>Required Fields:</legend>
<ol>
<li><label for="first_name">Name:</label>
<input name="first_name" id="first_name" type="text" required placeholder="First"></li>
<li><label for="last_name">Last:</label>
<input name="last_name" id="last_name" type="text" required placeholder="Last"></li>
<li><label for="e_mail">E-mail:</label>
<input name="e_mail" id="e_mail" type="email" required placeholder="[email protected]"></li>
</ol>
</fieldset>
<fieldset>
<legend>Conditional Select - Required:</legend>
<ol>
<li><label for="MySelect">Select One:</label>
<select name="MySelect" id="MySelect" size="5" required title="Please select something!">
<option value="0">None</option>
<option value="1">Audi</option>
<option value="2">Saab</option>
<option value="3">Fiat</option>
<option value="4">BMW</option>
</select></li>
<!--hidden-->
<li id="one">
<label for="option1">You selected Audi:</label>
<input name="option1" id="option1" type="text" placeholder="Year and Model" />
</li>
<li id="two">
<label for="option2">You selected Saab:</label>
<input name="option2" id="option2" type="text" placeholder="Year and Model" />
</li>
<li id="three">
<label for="option3">You selected Fiat:</label>
<input name="option3" id="option3" type="text" placeholder="Year and Model" />
</li>
<li id="four">
<label for="option4">You selected BMW:</label>
<input name="option4" id="option4" type="text" placeholder="Year and Model" />
</li>
<!--end hidden fields-->
</ol>
</fieldset>
<fieldset>
<legend>Optional Fields:</legend>
<ol>
<li>
<label for="phone">Phone:</label>
<input name="phone" id="phone" type="number" placeholder="(area code) 123-4567" />
</li>
<li><label for="subject">Subject:</label>
<input name="subject" id="subject" type="text" />
</li>
<li><label for="message">Message:</label>
<textarea id="message" name="message" placeholder="remarks"></textarea>
</li>
<li><input name="submit" type="submit" value="Submit">
</li>
</ol>
</fieldset>
</form>
<!--end form-->
<!--form validation-->
<script>
$(document).ready(function() {
$("#contact").validate();
$("#MySelect").validate();
//Custom jQuery to show/hide input fields based on selected options//
$('#one,#two,#three,#four') .hide();
$('#MySelect').bind('change', function (e) {
if( $('#MySelect').val() == 1) {
$('#one').show('slow');
else{
$('#one').hide();
if( $('#MySelect').val() == 2) {
$('#two').show('slow');
else{
$('#two').hide();
if( $('#MySelect').val() == 3) {
$('#three').show('slow');
else{
$('#three').hide();
if( $('#MySelect').val() == 4) {
$('#four').show('slow');
else{
$('#four').hide();
</script>
</body>
</html>
Nancy O.
Similar Messages
-
How to get selected value from selectOneRadio ???
Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
Plzzzzzzzz i need helpYou have a datatable in which each row is a question, correct?
Also in each row you have 5 possible answers that are in a radio, correct?
So,
You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
ex:
<h:selectOneRadio value="#{notas.selectedString}" id="rb">
<f:selectItem itemValue="#{notas.valuesList}"/>
</h:selectOneRadio>
Search the web for examples like yours. -
How to get selected value from OADefaultListBean.
Hi All,
How to get selected value from OADefaultListBean ?
Thanks,Hi,
To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
OADefaultListBean list =
(OADefaultListBean)webBean.findChildRecursive("positionsList");
String name = list.getName();
String[] selectedValues = pageContext.getParameterValues(name);
To retrieve all the values in the list box, call list.getOptionsData().
--Prasanna -
How to get selected row index of a Table ?
hi gurus,I'm new to Webdynpro for abap
I'm displaying just Flight details in a Table so
how to get selected row index of a Table and need to be display in Message manager.Hi,
For getting the row index use the following code.
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA index TYPE i.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_el_node = lo_nd_node->get_lead_selection( ).
index = lo_el_node->get_index( ).
node is the name of the node which is binded to the table.
For printing the message u can use code wizard.
Press ctrl-F7. Now Select generate message.
IN this select the method REPORT_SUCCESS
In the code now u can give index to Message text Exporting parameter. Comment receiving parameter.
Write the whole code in onLeadSelect of the table.
Regards,
Pankaj Aggarwal -
How to get selected row keys from RichSelectManyCheckbox
Adf Table has getSelectedRowKeys but SelectManyChekcbox does not has anything similar. Can you tell me how to get selected row keys programmatically for RichSelectManyCheckbox?
Hi User,
selectManyCheckbox component's value property holds the selected items values. Bind this property to some bean variable(of type list) so that you can get the selected values by accessing the bean property.
Sireesha -
Hello,
On a previous computer I used Illustrator for, when I would draw or make selections, next to the cursor in a small black box with white text, there would be the dimenstions information. It was similar to what you'd find in the Window>Info panel but simplified and would let you know how big the selection you're making is. I've looked all over the Preferences and can't find it. I can't tell if I was imagining it somehow or what, but I'm hoping someone knows what I'm talking about and knows where to find it. Thanks.Use smart guides: Cmd/Ctrl + U
-
How To Get Selected Or Clicked Menu Item Name Or ID
Hello.
My Question is
Is There Any Event In Form By Which I am able to get Clicked or Selected Menue Item's Name Or ID.
Thanx.
Shahzad Hafeez.You can use cell variant for your requirement . Go through the below link
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0310fd2-f40d-2a10-b288-bcbe0810a961
Regards,
Nethaji -
How to get selected items from a tree in backing bean without adfbc
Hi ADF Experts,
Below is my code for af:tree. My question is how can I get selected Items from the selectionListener (without adf bc) this uses formation of tree from backing bean.
Using Jdev 11.1.1.7.0
<af:tree var="node" value="#{pageFlowScope.MerchandizeBean.model}"
binding="#{pageFlowScope.MerchandizeBean.treeModel}" id="tree" immediate="true" autoHeightRows="0"
styleClass="AFStretchWidth" rowSelection="multiple"
selectionListener="#{pageFlowScope.MerchandizeBean.treeNodeSelection}">
<f:facet name="nodeStamp">
<af:commandLink text="#{node.classDescription}"
actionListener="#{pageFlowScope.MerchandizeBean.createListManyItemForMerchandise}" id="displayTable" partialSubmit="true">
</af:commandLink>
</f:facet>
</af:tree>
public void treeNodeSelection(SelectionEvent selectionEvent) {
// Add event code here...
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected value
Thanks
RoyHi,
in a multi select case, try
RowKeySet rks = tree.getSelectedRowKeys();
Iterator iter = rks.iterator();
while(iterator.hasNext()){
Object aKey = iterator.next();
tree. setRowKey(aKey);
Object rowData ? tree.getRowData();
.... do something with the data here ...
Frank -
How to get the profit centres determined in automatic payment run - F110
Hi,
In F110 - Automatic payment run, is it possible to get the profit centres determined ?
While doing manual payment, system gives the option to enter the related profit centres.
But in F110 how can I get the profit centre (cost obect) selected ?
Could anyone help ?Hi
I assume you are referring to the PC for the Bank account?
You can define the default PC in 3KEH.
Rgds
Nadini -
How to get selection screen elements and its table reference of a report ?
halo experts
How can I get selection screen elements and its table reference of a report ? . I tried rs_refresh_from_select_options. But I am unable to get the table and field it is referring to
For eg if my selection screen 1000 is
parameters: p_carrid type spfli-carrid,
select-options :s-_connid type sflight-connid.
is there any Fm or method which gives me what are the screen elements( p_carrid and s_connid ) and what table( splfi and sflight ) and field ( carrid and conid )it is referring to ?The following code is an example of how you might dynamically determine all your PARAMETERS and SELECT-OPTIONS variables at run time. The PARAMETERS and SELECT-OPTIONS only point to a dictionary element--not a specific table. Even though you may say "spfli-carrid" or "sflight-connid", the data type really references the dictionary type and not a specific table/structure.
REPORT ZTEST_PROG.
TABLES sflight.
DATA:
screen_tab TYPE STANDARD TABLE OF screen,
wa_screen TYPE screen,
scrn_nm TYPE string,
scrn_leftover TYPE string,
l_type TYPE REF TO cl_abap_typedescr,
typ_nm TYPE string,
typ_pre TYPE string.
FIELD-SYMBOLS <fs_data> TYPE ANY.
PARAMETERS p_carrid TYPE spfli-carrid.
SELECT-OPTIONS s_connid FOR sflight-connid.
INITIALIZATION.
LOOP AT SCREEN.
IF screen-group3 = 'PAR'
OR screen-group3 = 'LOW'.
APPEND screen TO screen_tab.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
LOOP AT screen_tab INTO wa_screen.
ASSIGN (wa_screen-name) TO <fs_data>.
l_type = cl_abap_typedescr=>describe_by_data( <fs_data> ).
IF wa_screen-group3 = 'LOW'.
SPLIT wa_screen-name AT '-' INTO scrn_nm scrn_leftover.
TRANSLATE scrn_nm TO UPPER CASE.
ELSE.
scrn_nm = wa_screen-name.
ENDIF.
SPLIT l_type->absolute_name AT '=' INTO typ_pre typ_nm.
WRITE:
/ 'Screen Name: ', scrn_nm,
/ 'DDIC Type: ', typ_nm.
ENDLOOP.
When you get into defining internal tables you can determine those at run time with cl_abap_structdescr. The following is an example of how you might do that. You can loop through the "components_table" and evaluate each field of the structure in this way.
DATA: structure_reference TYPE REF TO cl_abap_structdescr,
components_table TYPE abap_compdescr_tab,
components_structure LIKE LINE OF components_table.
structure_reference ?= cl_abap_structdescr=>describe_by_data( any_structure ).
components_table = structure_reference->components.
I don't know if this answers any of your questions but I hope that some of it is useful. -
How to get selected values from selectManyCheckbox ?
Hi,
I am a SOA developer and using 'Auto generated adf form' of Human Task. I did some customization in the form. I need to show one dynamic list (contains multiple string values) on a form, from which user will select desired values. For this I have used <af:selectManyCheckbox> adf component.
It has generated code as follows...
<af:selectManyCheckbox value="#{bindings.Response.inputValue}"
label="#{bindings.Response.label}"
id="smc1">
<f:selectItems value="#{bindings.Response.items}" id="si9"/>
</af:selectManyCheckbox>
I am able to show list on a form and can select multiple values also.
Now, I want the multiple selected values back in my BPEL process. I need only those values which are selected by user.
Currently I am getting complete list as it is back in BPEL process.
Please help me out..!
Thanks..
SurajUnwinding ADF: How to retrieve Selected Items from selectManyCheckbox using ValueChnageListener
-
How to get selected values from tableSelectMany
Hi all,
I have a view object which displays all column names of a table. I created a tableselectmany table with the view object.
the user has to select some rows (for mining function).
how to get the selected rows from tableselectmany table?
what should be in 'action' and 'actionlistener' ?
thanks in advance.test(Set<Key> empKeys){
System.out.println("Inside function");
for(Key keys:empKeys){
Row[] row = getCollectionsView1().findByKey(keys,1);
EewCollectionsViewRowImpl vo = (CollectionsViewRowImpl)row[0];
In the action just call this method(test)
and pass the argument as #{applicationScope.managedBean.firstProperty.selectionState.keySet}
I hope this works for you. -
How to get selected values from Select Many Choice List
Hello All -
I am using Select Many Choice List and wish to get the selected values in the bean. I have created method binding for valueChangeListener for the choice list, but not sure how to get the selected values.
I am facing problem in getting values from valueChangeEvent.getNewValue(). For Select One Choice List this returns int, but some list type object for Select Many Choice List.
When I try to print the value it comes something like:
ArrayList newVal = new ArrayList(Arrays.asList(valueChangeEvent.getNewValue()));
System.out.println(newVal);
[Ljava.lang.Integer;@870ad8
Could anyone please suggest how to type cast and use the return of valueChangeEvent.getNewValue() to get the selected values.
Regards -
RohitHi Timo -
Thanks for the suggestion. I could get the values as below:
public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
// Add event code here...
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
Integer[] values = (Integer[])valueChangeEvent.getNewValue();
for (int i=0; i<values.length; i++){
Row row = opUnitIter.getRowAtRangeIndex(i);
System.out.println(row.getAttribute("OpUnitId"));
Thanks -
Rohit -
How to get selected value from one choice list
Hi All,
i want to get selected value in onechoice list.how to achive this
Regards,
Smarancheck these
http://groundside.com/blog/DuncanMills.php?title=adf_the_list_binding_value_problem&more=1&c=1&tb=1&pb=1
http://blogs.oracle.com/jdevotnharvest/2010/12/reading_the_selected_value_of_an_adf_bound_select_list_in_java.html
http://www.oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html -
Dvt:pivotFilterBar - how to get selected values from filter
Hi all,
I have a question: how to programmatically get selected values from pivot table's filter bar?
I have tried to use
pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);but for page edge dimensions it returns BAD DATA, it seems that it returns some cached values.
Environment: JDev 11.1.1.3.0 without any patches.
thanks,
MiroslawHi,
You can retrieve the selected value in the PivotFilterBar through the model of PivotFilterBar, instead of dataaccess:
// get the model from the pivot filter bar instance
QueryDescriptior queryDescriptor = (QueryDescriptor)pivotFilterBar.getValue();
// retrieve a list of criterion, each one is used to populate each lov within the pivot filter bar
ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion();
List<Criterion> criterionList = conjunctionCriterion.getCriterionList();
for (int i=0; i<_criterionList.size(); i++) {
AttributeCriterion criterion = (AttributeCriterion)criterionList.get(i);
// _selected is the currently selected value
Object selected = criterion.getValues().get(0);
System.out.println(_selected);
Hope that helps,
Chadwick
Maybe you are looking for
-
Which AC adaptor can I use with my Satellite M40-307?
My dog has eaten the cable of my Satellite M40-307 (sadly he survived), I want (NEED) a replacement. The Toshiba web site lists the replacement as a 15-17V adaptor, where quite clearly the adaptor that came with my PC is a 19V adaptor. Also the back
-
Weblogic.jdbc.extensions.PoolLimitSQLException
Hi, I am using JDeveloper 11.1.2.4 in this case. Basically I am testing my application by deleting part of the URL of my application for example, if I have: http://localhost:7103/myApp/faces/pages/myPage.jsf?_afrLoop=714583137314224- I will delete ev
-
Preview builds Slow or Fast options available again
Just when I thought 9926 would be the last preview build until the RTM version is released, today, after installing update KB3035129, Slow or Fast options are available again. I also understand that build 9931 and 9932 are offered to MSFT. Does that
-
Hi, How do i add an icon to a viewswitch line entry the documentation suggests 'See also Handling Web Icons' but i cannot determine how.
-
Cant load webmail ran ok in version 4
I have just run the update to v5 and now cant access my webmail, the page loads but will not let me click on any buttons to view the folders/mail