Add form fields dynamically onchange of a select box.

I have a JSP page with a <h:form>:
<h:form id="registrationForm">
     <h:outputText value="#{Resource.EmailAddress}" /><br />
     <h:inputText label="E-mail Address" id="emailAddress" value="#{RegistrationBean.emailAddress}" required="true" requiredMessage="#{Resource.RequiredError}">
          <f:validator validatorId="EmailValidator" />
     </h:inputText><br />
     <h:message for="emailAddress" styleClass="error" /></td>
     Select age range<br />
     <h:selectOneMenu id="ageRange" value="#{RegistrationBean.ageRange}" valueChangeListener="#{RegistrationBean.updateComponents}" onchange="javascript: return submit()">
          <f:selectItems value="#{RegistrationBean.ageRangeValues}" />
     </h:selectOneMenu><br />
     <h:commandButton id="submit" value="#{Resource.Submit}" />
</h:form>When the user changes the value for the ageRange select box, the form gets submitted through the following JavaScript:
function submit() {
     document.forms[0].submit();
     return true;
}Then the ValueChangeListener defined in a backing bean for the ageRange select box gets called:
public void updateComponents(ValueChangeEvent e) {
     // Generate components automatically
}What I want is, when the user changes the value of the ageRange select box, the valueChangeListener should generate a few new text fields in the form and the validator for the e-mail address field shouldn't get called. The validator for the email-address field should only get called once the user clicks on the Submit button.
Any help or pointers will be greatly appreciated.

You can find here lot of pointers: http://balusc.blogspot.com/2007/10/populate-child-menus.html

Similar Messages

  • How to add form fields dynamically

    Hi
    I have a form with several fields, and in one section I have one check box and two text fields in a row and also have one button "Add more"
    when I click on the Add more button I need to create one more row with the above fields dynamically.
    how can I do it? Could some one suggest me with any code snippet?
    thanks,
    Suman K

    Use custom tags.
    Create all the new fields on the JSP page using custom tags ... i,e through Java code.

  • How we create dynamic add form field in web form

    How we create dynamic add form field in web form?

    Hi,
    Thanks for reply.
    I need to create a form in which "add more" input field dynamically. For
    example sometime we need field on or more. Please look at the demo, I need
    to create form as per demo in business catalyst:
    http://www.openjs.com/scripts/examples/addfield.php

  • Add form fields to tags - not working

    I have a fillable form with one simple text form field. I run the "Advanced > Accessibility > Add form fields to tags" but the tags do not change. After I run the command it is grayed out so it looks like it's done. I can save, close and reopen to make that command available again, but it never affects the tags and the accessibility check continues to give the error.
    Anyone have that problem or know how to fix it? I'm using Acrobat Pro 9.3.3
    Thanks!

    Rather than use TORU for form fields why not use the "Find" feature on the Options menu from the Tags panel?
    Find "Unmarked Annotations" then use the Tag Element button on the Find Element dialog.
    Select "Form" for the element ("tag").
    Add something useful to the "Title" field.
    [edit: n.b., this method lets you avoid putting a marquee down that inadvertently encompasses undesired text]
    This won't affect use of AT but gives you something to locate as you look over the structure tree.
    This method puts the <Form> element at the bottom of the structure tree; so, the elements would have to be manually moved to the proper location in the structure.
    Alternatively, place focus on the appropriate parent element for the PDF page content.
    The new <Form> element will be placed there - still may have to adjust it location in the structure tree - just closer to that location.
    As to working within the structure tree when adding elements.
    Yes, best practice that.
    TORU - Read Order provides a gross/macro view via the highlight(s) and element desination.
    Read Order should, in almost all cases, be harmonized to the structure tree's logical hierarchy.
    You may find use of the in-line grouping element <Span> useful.
    Be well...
    Message was edited by: CtDave

  • Cannot add form fields in document

    Acrobat Pro version 9.1.2
    Windows XP SP 3
    I have a document that I cannot add form fields to. When I try I get a message that says "You cannot edit the file as a form due to its security settings.
    When I go to Advanced->Security->Show Security Properties. The security method is set to No Security and everything is "Allow" under the Document Restrictions Summary.
    Where is there a security issue?

    Lori,
    How did you identify the PDF/A option? I am just curious for my future reference. I could not find it.
    ==================
    Rupey,
    The fonts are not embedded and that may also be something to address. A lot of these issues may be related to the 3rd party product used to create the PDF.

  • Add Form Fields using IAC

    Hello,
    I like to know if anyone lately has successfully added
    Form Fields (AFORMAUTLib.Fields) to a PDF document using IAC
    in Visual Studio 2008 and Acrobat 9.3.4 Prof.
    In this forum it was stated that bug in
    "AcroForm.api/AFormAUT 1.0 Type Library/Interop.AFORMAUTLib.dll"
    has been fixed in release 9.3.2
    I applied updated Acrobat to 9.3.4 and it still blows with error message
    "No document is currently open in the Acrobat Viewer"
    Any help, explanation is sincerely appreciated.
    Thanks.

    Rather than use TORU for form fields why not use the "Find" feature on the Options menu from the Tags panel?
    Find "Unmarked Annotations" then use the Tag Element button on the Find Element dialog.
    Select "Form" for the element ("tag").
    Add something useful to the "Title" field.
    [edit: n.b., this method lets you avoid putting a marquee down that inadvertently encompasses undesired text]
    This won't affect use of AT but gives you something to locate as you look over the structure tree.
    This method puts the <Form> element at the bottom of the structure tree; so, the elements would have to be manually moved to the proper location in the structure.
    Alternatively, place focus on the appropriate parent element for the PDF page content.
    The new <Form> element will be placed there - still may have to adjust it location in the structure tree - just closer to that location.
    As to working within the structure tree when adding elements.
    Yes, best practice that.
    TORU - Read Order provides a gross/macro view via the highlight(s) and element desination.
    Read Order should, in almost all cases, be harmonized to the structure tree's logical hierarchy.
    You may find use of the in-line grouping element <Span> useful.
    Be well...
    Message was edited by: CtDave

  • Firefox form fields do not clear when selected (i.e., "Enter Zip Code" should disappear when clicked). Has to be erased in vers. 8 & now 12

    I just upgraded from vers. 8 to 12 in order to fix this.
    Can't remember when this started, but it was mid version, not due to an update.
    At first, I thought vendors programmers were getting lazy, but then realized it was too prolific.
    Firefox form fields must be erased manually, after entering -- should go blank as soon as selected.
    Is this a setting I am missing

    In some cases, the temporary ("placeholder") content is inserted by a new method available in HTML5. This page has some boxes you can use to test whether this new feature is working in your Firefox.
    [http://www.html5accessibility.com/tests/placeholder-labelling.html HTML5 placeholder attribute tests] (please ignore the discussion about bugs)
    In other cases, the site may be using a script to clear the temporary content as soon as you click the box. This is necessary to support older browsers. If you block JavaScript on the page -- either by unchecking the Enabled box in the Options/Content tab or using the NoScript add-on -- then the temporary content will not be removed. However, if you are not blocking JavaScript, then the problem could be (i) the site's scripts or (ii) a conflict with another add-on, perhaps one that relates to automatic form filling.
    Can you give an example of a page where this is a problem?

  • How can I add form field value to the file name in save as dialog box

    I do not want the form to be saved automatically, just want the form to auto populate the "file name" only.
    A little background on the forms I want to use:  My company has 70 retail outlets, I'll use one of our pdf forms called an "Incident Report" as an example.  I would like for a store manager to be able to complete the form, then email the form to the main office (I already have javascript to add field values and form name to the email subject line), once the main office receives it, I want for them to be able to file the pdf electronically on our server.  We have mutliple forms that we use so I do not want any of the forms to automatically save anywhere, (at this time anyway) I just want the office personnel to be able to click "save as" (or whatever they will need to click) and the form automatically add certain field values from the pdf they have received, of which will be different each time the form is sent to the office (Date, store #, employee name etc.) in addition to the name of the form in the "File name" of the "Save As" dialog box.  The main office employees will decide into which server file the pdf should be saved.
    I'm using Acrobat 8 professional, the stores and office personnel use Adobe reader.
    One little note:  We currently print and file a lot of paper on a daily bases, as soon as I can get this to work, we are going green.
    Me and a lot of trees in this will really apprecitate any help you can give with this!  :-)

    You might want to take a look at the document "Developing Acrobat Applications Using JavaScript" (js_developer_guide.pdf) which is part of the Adobe Acrobat SDK, which can be downloaded here. Read the "Privileged versus non-privileged context" (p. 45ff.). You will find an example for "Executing privileged methods in a non-privileged context". Should be almost exactly what you are looking for.
    Small Outline: For security reasons ("the user always has to know what's going on") you are not allowed to use the "Doc.saveAs"-method without the user permission (--> in a non-privileged context). In order to reach the goal of a privileged context you can use a trusted function. You do this by creating a JavaScript file (*.js) in either the Application-JavaScript-Folder (default location on Windows systems: "%ProgramFiles%\Adobe\Acrobat 10.0\Acrobat\Javascripts") or the User-JavaScript-Folder (default location on Windows systems: "%AppData%\Adobe\Acrobat\10.0\JavaScripts"). Add the following content to the new file:
    myTrustedBrowseForDoc = app.trustedFunction( function ( oArgs ) {
         app.beginPriv();
              var myTrustedRetn = app.browseForDoc( oArgs );
         app.endPriv();
         return myTrustedRetn;
    myTrustedSaveAs = app.trustedFunction( function ( doc, oArgs ) {
         app.beginPriv();
              var myTrustedRetn = doc.saveAs( oArgs );
         app.endPriv();
         return myTrustedRetn;
    The developer guide actually wants you to add this content to the existing "config.js" file. I recommend creating a new file, since its easier to deploy in a network. Either way, every client/user who needs to be able to save documents this way, needs this JavaScript Code in his Application/User-JavaScript-Folder.
    Within the Acrobat Document, which you want to obtain a certain file name, you can now use the trusted functions "myTrustedBrowseForDoc" and "myTrustedSaveAs" to store the file. To call the trusted functions and deliver the file name you can either you use a form field (button) or you add a new menu item. Add the following JavaScript Action to the button/menu item and change "Roller Coaster" to the name of the field which contains the value which you want to become the new file name:
    var fileName = this.getField("Roller Coaster").valueAsString;
    try {
         var oRetn = myTrustedBrowseForDoc({bSave: true, cFilenameInit: fileName + ".pdf"});
         try {
              myTrustedSaveAs(this, { cPath: oRetn.cPath, cFS:oRetn.cFS });
         catch(e) {
              console.println("Save not allowed, perhaps readonly.");
    catch(e) {
    console.println("User cancelled Save As dialog box");
    Good Luck!

  • URGENT - Can I predefine form fields dynamically??

    Hello,
    I am wondering if I can predefine forms (pdf-form-fields) by content coming from a database for example. So the user only needs to validate the information instead of writing it by himself before printing it for example. Can anyone help me please?
    Thanks in advance,
    M

    Martin,
    This is not appropriate for the Reader forum. I think it might be
    possible if you used xml based pdf forms rather than what is known as
    Acroforms/Acrobat forums. Please re-ask in the Acrobat LiveCycle
    Designer forum:
    Mike

  • Captions - Is there a way to add form field captions in Acrobat Pro XI similar to LiveCycle?

    I lost LiveCycle in the CreativeCloud transition and form field captions were easy. Is there an easy way to make form field captions in Acrobat Pro XI? Or do I just need to create separate caption fields for each field? I hope I'm just missing something obvious...

    I know. Is there a way to tie the caption to the field similar to LiveCycle?
    Thanks for your help.

  • How do you use CS6 to add form fields to tables?

    Im trying to learn the new features of CS6 where you can add fields, buttons, dropdowns, etc... from within ID CS6.  The only thing about it I cant seem to find info on is what if I was using a table?  I generally create a text box and use the table/insert table to add my rows and columns.  Though when trying to make them into fields, it seems to want to make the whole text box a field and not the individual cells.  Is there a way to do this?

    You can find the list by using your iPhone to go to the app store. Under the featured section at the top scroll to the right until you see the icon labeled "Apps for Passbook." Click that and you will see the same apps that was listed on the screen of the Passbook app itself. I don't know if Apple intended for this to be this way, but unless they change things you can't get back to the main screen within the Passbook app itself. The "Apps for Passbook" will not appear if you do the search from an iPad.

  • Servlet to add form elements dynamically

    I have a program that populates text boxes from a database resultset (Oracle 8i) using a vector that I pass to a jsp form. The problem is I want to make it dynamic where the number of textboxes could grow or shrink depending on the size of the vector I pass to the request object.
    Any ideas as to how this could be done?

    Try using a for loop...
    int vectorSize = <get the vector size>;
    for(int i = 0; i < vectorSize; i++){
    out.print("<input type = "textbox">);
    }

  • Add Face....Can't select box to move position of face

    I have ran into this a few times now. If a photo has multiple faces, but iPhoto only picked up on a couple and left out one or more. I go into the photo and ADD FACE, if the previous faces that iPhoto found are in the middle of the photo, the newly created EMPTY face box cannot be selected. Very frustrating.
    My only fix has been to delete all faces found on that photo and then add the faces in order as to not have this occur manually.
    thoughts? suggestions?

    I have the same issue, but I only have to delete the face box in the center of the photo, since that's where the new photo box will appear. For example, if I have to tag 5 people, I just delete the one in the middle, add new face boxes and drag them to the non-middle locations, and then add back the one in the middle. I don't have to delete all the faces on that photo to do this - just the one in the middle. I agree that it's frustrating, though.

  • Duplicating form fields from one PDF document to another

    Hi,
    Does anyone know of a way to select and duplicate all acrobat form fields from one PDF document into a new PDF document. I know I can do so one field at a time but would like to know if there is a way to do so in a wholesale fashion.
    Our PDF documents are created in-house each year and are nearly the same as the previous year's document containing 99% of the same form fields in the same locations. These forms contain a lot of form fields, anywhere from 50 to 100 fields.
    Rather than start from scratch each year defining the same fields that were present in the previous year's document, I am looking for a way to copy the form fields from an existing PDF document (last year's PDF in our case) and copy the form fields into a new PDF document (that does not yet have any form fields defined) and hopefully maintain all the field attributes and positions from the previous years document.
    Thanks for any suggestions,
    Steve

    The PDF template we need to copy the form fields "to" doesn't start out having any form fields. It is the fields that we need copied from a previous year's PDF template.
    Here's an except from my original post: "I am looking for a way to copy the form fields from an existing PDF document (last year's PDF in our case) and copy the form fields into a new PDF document (that does not yet have any form fields defined)"
    The "new" PDF template is a complete "paper" form with updated legal text and calendar year referrences but NO form fields. In our IS group, we then take these forms, add form fields to them and are then able to populate them with database-resident user data. We serve them up to the user in their browser pre-populated with their application data.
    So again, our need is to find a way to copy form fields from "last year's" PDF template and copy just the form fields to an fresh "new year's" PDF template that contains no form fields to begin with. What we begin with is just a PDF representation of a paper student loan application.
    Thanks for the suggestion!

  • Dynamic width of s:select

    Hi,
    taglib prefix="s" uri="/struts-tags"
    <s:select list="" cssStyle="width:20px;" id="">
    </s:select>
    Can I make an s:select list that has static width behave based on the data as follows :
    1. When the dropdown is selected, it dynamically increases based on the largest text in the list
    2. When selected the list goes back to the static width (hiding text if needed).
    Thanks !!

    Hi,
    This issue is now resolved. I had posted my issue in http://www.webdeveloper.com/ to get the solution.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <script language="JavaScript" type="text/javascript">
    /* This function is to enable dynamic width of the select box.
    * This method can be called on two ways based on the users need of
    * 1. If they want to have the expanded text box till they move to the next field
    * 2. If they want the default size to be set once the selection is made
    * The settings are -
    * 1. onclick="dynamicWidth(true,20);" onblur="dynamicWidth(false,20);" onchange="dynamicWidth(false,20);"
    * 2. onfocus="dynamicWidth(true,20);" onblur="dynamicWidth(false,20);" onchange="dynamicWidth(false,20);"
    function dynamicWidth(evt,conversionFactor){
    var selection = document.getElementById('test');
    if (!selection.minmax){
    selection.minmax=[parseInt(selection.style.width),0];
    for (var i=0; i<selection.options.length;i++){
    if (selection.text.length>selection.minmax[1]){
    selection.minmax[1] = selection[i].text.length*conversionFactor;
    selection.style.width = (evt?selection.minmax[1]:selection.minmax[0])+'px';
    </script></head>
    <body>
    <select id="test" onclick="dynamicWidth(true,20);" onblur="dynamicWidth(false,20);" onchange="dynamicWidth(false,20);" style="width:50px;" >
    <option >Option one</option>
    <option >Option two which is long</option>
    <option >Option three which is longer</option>
    <option >Option four which is even more long</option>
    </select>
    </body>
    </html>

Maybe you are looking for