Conditional Validation using Spry

When are we going to see things like conditional validations in DW using spry?
I am by no means a developer and enjoy using DW for its simplicity but I have a situation at the moment wherby I need to make a text box required if a checkbox group or radio button group is ticked and on top of this I also need to make another textbox required if any of a number of groups are answered 'yes'
If anyone has any help they can give me to achieve my goal I would be very grateful.
Also if anyone from Adobe has an answer to my opening question then that would be great
Thanks

blandad1976 wrote:
When are we going to see things like conditional validations in DW using spry?
I am by no means a developer and enjoy using DW for its simplicity but I have a situation at the moment wherby I need to make a text box required if a checkbox group or radio button group is ticked and on top of this I also need to make another textbox required if any of a number of groups are answered 'yes'
If anyone has any help they can give me to achieve my goal I would be very grateful.
Also if anyone from Adobe has an answer to my opening question then that would be great
Thanks
Seek and ye shall find!  See here http://forums.adobe.com/message/2978837#2978837
Gramps

Similar Messages

  • Conditional Validation using JSLink

    I have a User field and a Choice field in a list.  When the Choice field has the option "A" selected I want the User field to be mandatory.  Validation formulas in lists cannot use User field data types so this is not an option.  Is
    JSLink the way to go?  If so how would I implement conditional validation?  I can find examples of simple regex validation but nothing that helps to do conditional validation.
    Caroline

    Hi,
    According to your post, my understanding is that you want to set the User field automatically when the Choice field select a value.
    We can use jQuery to achieve it. Using jQuery .Change() method to monitor the choice, then set the value for the User field.
    The following articles for your reference:
    http://runnable.com/Ue9c4krQF7VjAAAP/how-to-get-selected-option-using-jquery
    http://jasonscript.wordpress.com/2013/08/07/javascript-and-working-with-the-sharepoint-2013-people-picker/
    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

  • Spry Conditional Validation of Txt Boxes When Using Show/Hide

    Hi everyone.. just a quick question (if their is such a thing) if that is ok...
    I have been working on this single issue for 3 days.. it is driving me mad and hoped someone may be able to point me in the right direction...
    I have a form and it has a radio button with 3 options (about relationship status):
    Married
    Defacto
    Single
    If they select married a text box appears with Enter spouses first name;
    If they select defacto a text box appears with Enter partners first name..
    If single no text box appears..
    User then clicks on next to go to next page..
    All good.. except.. I am using DW CS4 and using spry to validate both txt boxes (spouses first name and partner first name).. problem is only one will be displayed depending on the option selected – Married or defacto.. spry tries to validate both even the hidden one and therefore will not allow the user to go to next page.. as at least one not completed..
    I have spent almost 3 days trying to write a php/java if statement to get spry to only validate text box 1 or 2 if radio button says married, defacto or single etc..
    I would really really really apperciate your input about how I should do this as it is driving me nuts!!!
    Anyway thanks and really hope to hear from someone..
    Cheers from Downunder
    UPDATE:
    Been playing and got this to work:
    <script type="text/javascript">
    function decision(){
    if(document.martial_status.martial_status[0].checked) {
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:blur});
    //-->
    sprytextfield1.reset();
    } else if(document.martial_status.martial_status[1].checked) {
    } else if(document.martial_status.martial_status[2].checked) {
    window.alert("test3");
    } else {
    window.alert("Pick something!!");
    // -->
    </script>
    BUT (and always a but).. if person goes back and selects say single rather then married after already clicking married the spry error msg is already in place for married.. and person cannot go to next page.. The joys.. tried martial_statur.reset and destroy and does clear the error message but still does not allow user to go to next page..
    Any thoughts? Thanks in advance..

    You can destory the validation:
    sprytextfield1.destroy();
    and it should validate.

  • How to use Spry Validator without get all fields required

    Hi,
    I have a problem with a form were i use Spry Validator i want only 4 fields to be required but now all the fields are required and i don't know why.
    Thanks for your help!

    I get finally my answer by using this tutorial :
    http://www.youtube.com/watch?v=EdkQUEpLHdk
    Have nice day!

  • Use Spry Validation with jQuery Form to Form Wizard (v1.1)

    I am trying to use spry validation widgets with jQuery Form to Form Wizard script found here http://www.dynamicdrive.com/dynamicindex16/formwizard.htm
    This is a script that makes a long form into a multi part wizard/form with next and back buttons.
    for the most part it works with the spry widgets on blur and onsubmit, but to make it work properly the next buttons of the script should be disabled until the user corrects what has caused spry error messages.  The script creator has made onpagechangestart event handler to allow for this.  Description here http://www.dynamicdrive.com/dynamicindex16/formwizard_suppliment.htm. By returning false from this event handler, you disable the user's ability to go on to the next page until a value of true is returned.
    How can I script for Spry validation to return false if it has errors from this event handler?
    Thanks in advance for any help,

    did you check this example:
    http://labs.adobe.com/technologies/spry/samples/form_submission/Submit_and_Validate_Form.p hp.html

  • Spry Conditional Validation

    Hello,
    I am using Spry Pre-Release 1.6.1. Here is what I am trying to do:
    A user makes some input. Based on that input I am showing 5 additional fields that now must be required.
    I can get this to work on the first field( spryselect4) but not on any of the following fields. Below is a snippet of my code:
    var spryselect4;
    var sprytextfield15;
    var sprytextfield17;
    var sprytextfield18;
    var sprytextfield19;
    var sprytextfield21;
    var sprytextfield22;
    var sprytextfield23;
    function setFamilySpry(val){
        // get the value
        if(val == 1){
            // if there inst a validaton build one
            if(!spryselect4){
                spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {validateOn:["blur"]});
              if(!sprytextfield15){
                var sprytextfield15 = new Spry.Widget.ValidationTextField("sprytextfield15", "none");
              if(!sprytextfield17){
                var sprytextfield17 = new Spry.Widget.ValidationTextField("sprytextfield17", "none");
              if(!sprytextfield18){
                var sprytextfield18 = new Spry.Widget.ValidationTextField("sprytextfield18", "email", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield19){
                var sprytextfield19 = new Spry.Widget.ValidationTextField("sprytextfield19", "phone_number", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield21){
                var sprytextfield21 = new Spry.Widget.ValidationTextField("sprytextfield21", "none");
              if(!sprytextfield22){
                var sprytextfield22 = new Spry.Widget.ValidationTextField("sprytextfield22", "phone_number", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield23){
                var sprytextfield23 = new Spry.Widget.ValidationTextField("sprytextfield23", "none");   
        } else {
            // if there is a validaiton in sprytextfield destory it, and clear the variable
            if(spryselect4 && spryselect4.destroy){
                spryselect4.reset();
                spryselect4.destroy();
                spryselect4 = null;
             if(sprytextfield15 && sprytextfield15.destroy){           
                sprytextfield15.reset();
                sprytextfield15.destroy();
                sprytextfield15 = null;
                 if(sprytextfield17 && sprytextfield17.destroy){
                sprytextfield17.reset();
                sprytextfield17.destroy();
                sprytextfield17 = null;   
                 if(sprytextfield18 && sprytextfield18.destroy){
                sprytextfield18.reset();
                sprytextfield18.destroy();
                sprytextfield18 = null;   
                 if(sprytextfield19 && sprytextfield19.destroy){
                sprytextfield19.reset();
                sprytextfield19.destroy();
                sprytextfield19 = null;   
                 if(sprytextfield21 && sprytextfield21.destroy){           
                sprytextfield21.reset();
                sprytextfield21.destroy();
                sprytextfield21 = null;   
                 if(sprytextfield22 && sprytextfield22.destroy){           
                sprytextfield22.reset();
                sprytextfield22.destroy();
                sprytextfield22 = null;   
                 if(sprytextfield23 && sprytextfield23.destroy){           
                sprytextfield23.reset();
                sprytextfield23.destroy();
                sprytextfield23 = null;   
        // proceed with the rest as normal
        return true;
    When the user selects "1". All the fields listed above become required. But when they select an option other than "1". Only the first field( spryselect4) reverts back to not being required. All the other fields remain required.
    Anyone have a clue... I am stumped.

    Hello,
    I am using Spry Pre-Release 1.6.1. Here is what I am trying to do:
    A user makes some input. Based on that input I am showing 5 additional fields that now must be required.
    I can get this to work on the first field( spryselect4) but not on any of the following fields. Below is a snippet of my code:
    var spryselect4;
    var sprytextfield15;
    var sprytextfield17;
    var sprytextfield18;
    var sprytextfield19;
    var sprytextfield21;
    var sprytextfield22;
    var sprytextfield23;
    function setFamilySpry(val){
        // get the value
        if(val == 1){
            // if there inst a validaton build one
            if(!spryselect4){
                spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {validateOn:["blur"]});
              if(!sprytextfield15){
                var sprytextfield15 = new Spry.Widget.ValidationTextField("sprytextfield15", "none");
              if(!sprytextfield17){
                var sprytextfield17 = new Spry.Widget.ValidationTextField("sprytextfield17", "none");
              if(!sprytextfield18){
                var sprytextfield18 = new Spry.Widget.ValidationTextField("sprytextfield18", "email", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield19){
                var sprytextfield19 = new Spry.Widget.ValidationTextField("sprytextfield19", "phone_number", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield21){
                var sprytextfield21 = new Spry.Widget.ValidationTextField("sprytextfield21", "none");
              if(!sprytextfield22){
                var sprytextfield22 = new Spry.Widget.ValidationTextField("sprytextfield22", "phone_number", {useCharacterMasking:true, validateOn:["blur"]});
              if(!sprytextfield23){
                var sprytextfield23 = new Spry.Widget.ValidationTextField("sprytextfield23", "none");   
        } else {
            // if there is a validaiton in sprytextfield destory it, and clear the variable
            if(spryselect4 && spryselect4.destroy){
                spryselect4.reset();
                spryselect4.destroy();
                spryselect4 = null;
             if(sprytextfield15 && sprytextfield15.destroy){           
                sprytextfield15.reset();
                sprytextfield15.destroy();
                sprytextfield15 = null;
                 if(sprytextfield17 && sprytextfield17.destroy){
                sprytextfield17.reset();
                sprytextfield17.destroy();
                sprytextfield17 = null;   
                 if(sprytextfield18 && sprytextfield18.destroy){
                sprytextfield18.reset();
                sprytextfield18.destroy();
                sprytextfield18 = null;   
                 if(sprytextfield19 && sprytextfield19.destroy){
                sprytextfield19.reset();
                sprytextfield19.destroy();
                sprytextfield19 = null;   
                 if(sprytextfield21 && sprytextfield21.destroy){           
                sprytextfield21.reset();
                sprytextfield21.destroy();
                sprytextfield21 = null;   
                 if(sprytextfield22 && sprytextfield22.destroy){           
                sprytextfield22.reset();
                sprytextfield22.destroy();
                sprytextfield22 = null;   
                 if(sprytextfield23 && sprytextfield23.destroy){           
                sprytextfield23.reset();
                sprytextfield23.destroy();
                sprytextfield23 = null;   
        // proceed with the rest as normal
        return true;
    When the user selects "1". All the fields listed above become required. But when they select an option other than "1". Only the first field( spryselect4) reverts back to not being required. All the other fields remain required.
    Anyone have a clue... I am stumped.

  • Join condition validation error in owb 10gR2

    Hi friends,
    When I tried to validate the join condition in the mapping im getting the below error like
    an error occurred during expression validation, bad expression return type
    When I googled for the above error, I got the below link mentioning like a bug for that join condition validation problem
    https://forums.oracle.com/thread/717194
    In which it is mentioned like a BugNo: 7417869 for that issue.
    Is there any fix for that bug??
    Thanks in advance.
    Brgds,
    Mini

    Dear Allan,
    Happy to get reply from you and sorry for my late reply as im been stuck with other work
    Like you said, I downloaded the required patch 4898608 for the validation bug in mapping with owb 10.2.0.4. By viewing the readme.txt file of the patch I followed the below steps like
    Set the ORACLE_HOME environment variable to point to the OWB Home
    Add $ORACLE_HOME/OPatch  in the PATH
    Stopped the runtime service using the supplied SQL*PLUS script stop_service.sql as a rep_owner
          OWB_HOME/rtp/sql/stop_service.sql
    After the above three steps I applied the opatch like below in cmd prompt
    C:\orahome\10gR3_1\OPatch>opatch version
    Invoking OPatch 10.2.0.4.9
    OPatch Version: 10.2.0.4.9
    OPatch succeeded.
    C:\OraHome_1\OPatch>opatch apply
    Invoking OPatch 10.2.0.4.9
    Oracle Interim Patch Installer version 10.2.0.4.9
    Copyright (c) 2009, Oracle Corporation.  All rights reserved.
    Oracle Home       : C:\OraHome_1
    Central Inventory : C:\Program Files (x86)\Oracle\Inventory
       from           : n/a
    OPatch version    : 10.2.0.4.9
    OUI version       : 10.2.0.1.0
    OUI location      : C:\OraHome_1\oui
    Log file location : C:\OraHome_1\cfgtoollogs\opatch\opatch2013-06-24_18-14-27PM.
    log
    Patch history file: C:\OraHome_1\cfgtoollogs\opatch\opatch_history.txt
    Failed to load the patch object.  Possible causes are:
      The specified path is not an interim Patch shiphome
      Meta-data files are missing from the patch area
      Patch location = C:\OraHome_1\OPatch
      Details = PatchObject constructor: Input file "C:\OraHome_1\OPatch\etc\config\
    actions" or "C:\OraHome_1\OPatch\etc\config\inventory" does not exist.
    ApplySession failed: PatchObject constructor: Input file "C:\OraHome_1\OPatch\et
    c\config\actions" or "C:\OraHome_1\OPatch\etc\config\inventory" does not exist.
    System intact, OPatch will not attempt to restore the system
    OPatch failed with error code = 73
    C:\OraHome_1\OPatch>
    Im not sure why the above error is occuring, kindly help me with that error.
    Thanks in advance.
    Brgds,
    Mini

  • Conditional validation?

    Hi folks, is it possible using Spry to specify that either a
    text field should be filled in OR a checkbox be checked? The
    real-world example is either requiring the price of a car to be
    filled in or the user has to check a checkbox "POA" which indicates
    the vehicle price is available on application. It looks like Spry
    only allows me to specify that the price field is required or not,
    and the checkbox is required or not, and there seems to be no way
    to allow for one of the two to be filled in... is this a hard and
    fast limitation, or does someone perhaps know of a way I could do
    it?
    Thanks in advance, you folks are awesome!

    Why don't you generate the validation when the checkbox is
    clicked
    <input onclick="buildValidation()" />
    var textfield;
    function(){
    if(this.checked){
    textfield = new Spry.Widget.Validation('bla','e-mail');
    } else {
    if(textfield)
    try{textfield.destroy()}catch(e){}
    basicly if the checkbox is checked it creates a new
    validation for your textfield, else it will destory the validation
    if there is one found.

  • Conditional validation for drop down list

    Hi all,
    I have been working on getting the conditional validation for drop down list to work but no luck. Here is my situation. I have a page with 'time' and 'source' drop down which contains a list of values along with null value. I have two buttons 'save' and 'close'. when a User clicks on 'Save' button, no checking should occur and the values filled in the form should be stored into the database. When a user clicks on 'Close' button, validation should occur and messages should be displayed saying 'values should be filled' . After the user fills each drop down list and hits close button, changes should be saved to the database. I used the technique posted by Jayashri and wrote the validation code in 'Close button action method'
    Here is my code
    public String btnClose_action() {
    // TODO: Replace with your code
    try {
    if (ddlTime.getSelected() == null || ddlTime.getSelected().equals("")) {
    FacesMessage message3 = new FacesMessage("Please select a value");
    message3.setSeverity(FacesMessage.SEVERITY_ERROR);
    getFacesContext().addMessage(ddlTime.getClientId(getFacesContext()), message3);
    return null;
    if (ddlSourceReq.getSelected() == null || ddlSourceReq.getSelected().equals("")) {
    FacesMessage message4 = new FacesMessage("Please select a value");
    message4.setSeverity(FacesMessage.SEVERITY_ERROR);
    getFacesContext().addMessage(ddlSourceReq.getClientId(getFacesContext()), message4);
    return null;
    sendMail("close");
    } catch (Exception ex) {
    return null;
    public String btnSave_action() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    sendMail("save");
    return null;
    I did not set the 'required' property of both the drop downs and I dont have any message components in the page. How do I get this to work. Please help.
    Thanks,
    S

    Hi,
    Try this
    HTP.p('
    function validate_form_fields()
    var validation = true;
    if (document.forms[0].fld_1.options[document.forms[0].fld_1.selectedIndex] == null )
    validation = false;
    alert("Selection of FLD1 is mandatory.");
    if (document.forms[0].fld_2.options[document.forms[0].fld_2.selectedIndex] == null )
    validation = false;
    alert("Selection of FLD 2 is mandatory.");
    return validation;
    ');If the above does not work, it could be the definition of the your fld_1 select - options. Looks like they allow null values, and if null is not the first option then selectIndex = 0 will be a not null option by default.
    Moreover, the below has redundant condition as ==0 and &lt; 1 amount to the same thing. selectIndex cannot be negative.
    if ((document.forms[0].fld_1.selectedIndex == 0 ) || (document.forms[0].fld_1.selectedIndex < 1 ))Regards,

  • How to Use Spry to Validate Radio button

    How to use Spry Validation for radio button?
    The samples only have checkbox, text, select and textarea.
    Thanks

    I needed to add radio buttons to the live (non-destructive)
    filter so users could choose which column they wanted to search
    data from. Its been modified from the "contains CB" but works
    nicely. It also had to rebuild table when another button was
    selected. I'll post some code if anyone would like to use it....
    The Form area -
    <form name="filterform">
    Data Filter: <input type="text" id="filterTF"
    onkeyup="StartFilterTimer();" />
    <input type="radio" id="containsCB" name="radio"
    value="module" onclick="resetfilter();" checked /> by Module
    <input type="radio" id="containsCB" name="radio"
    value="oper" onclick="resetfilter();" /> by Oper
    <input type="radio" id="containsCB" name="radio"
    value="phone" onclick="resetfilter();" /> by Phone
    <div id="radiovalue"></div>
    </form>
    The JS area -
    function FilterData()
    var tf = document.getElementById("filterTF");
    for (var c=0; c < document.filterform.length; c++)
    if (document.filterform[c].checked)
    var choice = document.filterform[c].value;
    if (!tf.value)
    // If the text field is empty, remove any filter
    // that is set on the data set.
    dsRows.filter(null);
    return;
    // Set a filter on the data set that matches any row
    // that begins with the string in the text field.
    var regExpStr = tf.value;
    regExpStr = "^" + regExpStr;
    var regExp = new RegExp(regExpStr, "i");
    var filterFunc = function(ds, row, rowNumber)
    var str = row[choice];
    if (str && str.search(regExp) != -1)
    return row;
    return null;
    dsRows.filter(filterFunc);
    function StartFilterTimer()
    if (StartFilterTimer.timerID)
    clearTimeout(StartFilterTimer.timerID);
    StartFilterTimer.timerID = setTimeout(function() {
    StartFilterTimer.timerID = null; FilterData(); }, 400);
    function resetfilter() {
    // var tf = document.getElementById("filterTF");
    // var tfval = tf.value;
    document.getElementById("filterTF").value = "";
    StartFilterTimer();

  • Mass change Condition valid to dates into Info record

    Hi,
    is there any mass changes for condition validity to dates into purchase info record?????
    i have check into MEMASSIN, there is field for conditions valid to Date,
    Pl. guide .
    Regards,
    Devendra

    Hi,
    It is not possible to  change validity date using MEMASSIN - Mass Maintenance t code.
    You need to create LSMW with recording method to achieve this. we are doing the same.
    It is very easy. And take care that while recording select the validity button and click executive to record the do not double click on the validity tab.
    Reg

  • MM rebate condition validity

    Hi,
    I have the scenario whereby a vendor give a rebate, for a selected period.  within that perios they may grant additional rebate  ie agreement over 1 year - but for august they give higher rebate value.  how can i set this up ?  Im using A002 condition but i cant enter condition validity periods.
    any help appreciated.  No vague answers please.
    cheers
    Graham

    Amy,
    Do you mean to say, you can see the rebate conditions in the item conditions of the invoice before it was released to accounting  and after releasing to accounting they disappeared from the item conditions ?
      I'm sure it shouldn't happen. If it disappears it should disappear irrespective of the release to accounting.
    Analyze the pricing at the item condition level why the rebate conditions doesn't show up.
    If it didn't' work please let me understand your problem..
    Regards,
    Aj.

  • Not able to run validation using validation.xml & validator-rules.xml

    Hello Friends,
    I am not able to run validation using validation.xml & validator-rules.xml.
    Entire code in running prefectly but no error messages are prompted.
    Following is my code:
    File Name : struts-config.xml
    <struts-config>
    <!-- Form Beans Configuration -->
    <form-beans>
    <form-bean name="searchForm"
    type="com.solversa.SearchForm"/>
    </form-beans>
    <!-- Global Forwards Configuration -->
    <global-forwards>
    <forward name="search" path="/search.jsp"/>
    </global-forwards>
    <!-- Action Mappings Configuration -->
    <action-mappings>
    <action path="/search"
    type="com.solversa.SearchAction"
    name="searchForm"
    scope="request"
    validate="true"
    input="/search.jsp">
    </action>
    </action-mappings>
    <!-- Message Resources Configuration -->
    <message-resources
    parameter="ApplicationResources"/>
    <!-- Validator Configuration -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
    value="/WEB-INF/validator-rules.xml,
    /WEB-INF/validation.xml"/>
    </plug-in>
    </struts-config>
    <br> File Name : <b> validation.xml </b>
    <form-validation>
    <formset>
    <form name="searchForm">
    <field property="name" depends="minlength">
    <arg key="label.search.name" position = "0"/>
    <arg1 name="minlength" key="${var:minlength}" resource="false"/>
    <var>
    <var-name>minlength</var-name>
    <var-value>5</var-value>
    </var>
    </field>
    <field property="ssNum" depends="mask">
    <arg0 key="label.search.ssNum"/>
    <var>
    <var-name>mask</var-name>
    <var-value>^\d{3}-\d{2}-\d{4}$</var-value>
    </var>
    </field>
    </form>
    </formset>
    </form-validation>
    <br> File Name : <b> SearchForm.java </b>
    package com.jamesholmes.minihr;
    import java.util.List;
    import org.apache.struts.validator.ValidatorForm;
    public class SearchForm extends ValidatorForm
    private String name = null;
    private String ssNum = null;
    private List results = null;
    public void setName(String name) {
    this.name = name;
    public String getName() {
    return name;
    public void setSsNum(String ssNum) {
    this.ssNum = ssNum;
    public String getSsNum() {
    return ssNum;
    public void setResults(List results) {
    this.results = results;
    public List getResults() {
    return results;
    <br> File Name : <b> SearchAction.java </b>
    package com.jamesholmes.minihr;
    import java.util.ArrayList;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public final class SearchAction extends Action
    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception
    EmployeeSearchService service = new EmployeeSearchService();
    ArrayList results;
    SearchForm searchForm = (SearchForm) form;
    // Perform employee search based on what criteria was entered.
    String name = searchForm.getName();
    if (name != null && name.trim().length() > 0) {
    results = service.searchByName(name);
    } else {
    results = service.searchBySsNum(searchForm.getSsNum().trim());
    // Place search results in SearchForm for access by JSP.
    searchForm.setResults(results);
    // Forward control to this Action's input page.
    return mapping.getInputForward();
    <br> File Name : <b> EmployeeSearchService.java </b>
    package com.jamesholmes.minihr;
    import java.util.ArrayList;
    public class EmployeeSearchService
    /* Hard-coded sample data. Normally this would come from a real data
    source such as a database. */
    private static Employee[] employees =
    new Employee("Bob Davidson", "123-45-6789"),
    new Employee("Mary Williams", "987-65-4321"),
    new Employee("Jim Smith", "111-11-1111"),
    new Employee("Beverly Harris", "222-22-2222"),
    new Employee("Thomas Frank", "333-33-3333"),
    new Employee("Jim Davidson", "444-44-4444")
    // Search for employees by name.
    public ArrayList searchByName(String name) {
    ArrayList resultList = new ArrayList();
    for (int i = 0; i < employees.length; i++) {
    if (employees.getName().toUpperCase().indexOf(name.toUpperCase()) != -1) {
    resultList.add(employees[i]);
    return resultList;
    // Search for employee by social security number.
    public ArrayList searchBySsNum(String ssNum) {
    ArrayList resultList = new ArrayList();
    for (int i = 0; i < employees.length; i++) {
    if (employees[i].getSsNum().equals(ssNum)) {
    resultList.add(employees[i]);
    return resultList;
    <br> File Name : <b> Employee.java </b>
    package com.solversa;
    public class Employee
         private String name;
         private String ssNum;
         public Employee(String name, String ssNum) {
         this.name = name;
         this.ssNum = ssNum;
         public void setName(String name) {
         this.name = name;
         public String getName() {
         return name;
         public void setSsNum(String ssNum) {
         this.ssNum = ssNum;
         public String getSsNum() {
         return ssNum;
    Pls help me out.
    Not able to prompt errors.

    Hello Friends,
    I am not able to run validation using
    validation.xml & validator-rules.xml.
    Entire code in running prefectly but no error
    messages are prompted.
    Following is my code:
    File Name : struts-config.xml
    <struts-config>
    <!-- Form Beans Configuration -->
    <form-beans>
    <form-bean name="searchForm"
    type="com.solversa.SearchForm"/>
    ans>
    <!-- Global Forwards Configuration -->
    <global-forwards>
    <forward name="search" path="/search.jsp"/>
    global-forwards>
    <!-- Action Mappings Configuration -->
    <action-mappings>
    <action path="/search"
    type="com.solversa.SearchAction"
    name="searchForm"
    scope="request"
    validate="true"
    input="/search.jsp">
    tion>
    </action-mappings>
    <!-- Message Resources Configuration -->
    <message-resources
    parameter="ApplicationResources"/>
    <!-- Validator Configuration -->
    <plug-in
    className="org.apache.struts.validator.ValidatorPlugI
    ">
    <set-property property="pathnames"
    value="/WEB-INF/validator-rules.xml,
    /WEB-INF/validation.xml"/>
    >
    </struts-config>
    <br> File Name : <b> validation.xml </b>
    <form-validation>
    <formset>
    <form name="searchForm">
    <field property="name" depends="minlength">
    <arg key="label.search.name" position = "0"/>
    <arg1 name="minlength" key="${var:minlength}"
    resource="false"/>
    <var>
    <var-name>minlength</var-name>
    <var-value>5</var-value>
    </var>
    </field>
    <field property="ssNum" depends="mask">
    <arg0 key="label.search.ssNum"/>
    <var>
    <var-name>mask</var-name>
    <var-value>^\d{3}-\d{2}-\d{4}$</var-value>
    </var>
    </field>
    /form>
    </formset>
    form-validation>
    <br> File Name : <b> SearchForm.java </b>
    package com.jamesholmes.minihr;
    import java.util.List;
    import org.apache.struts.validator.ValidatorForm;
    public class SearchForm extends ValidatorForm
    private String name = null;
    private String ssNum = null;
    private List results = null;
    public void setName(String name) {
    this.name = name;
    public String getName() {
    return name;
    public void setSsNum(String ssNum) {
    this.ssNum = ssNum;
    public String getSsNum() {
    return ssNum;
    public void setResults(List results) {
    this.results = results;
    public List getResults() {
    return results;
    <br> File Name : <b> SearchAction.java </b>
    package com.jamesholmes.minihr;
    import java.util.ArrayList;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public final class SearchAction extends Action
    public ActionForward execute(ActionMapping
    mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception
    EmployeeSearchService service = new
    EmployeeSearchService();
    ArrayList results;
    SearchForm searchForm = (SearchForm) form;
    // Perform employee search based on what criteria
    was entered.
    String name = searchForm.getName();
    if (name != null && name.trim().length() > 0) {
    results = service.searchByName(name);
    else {
    results =
    service.searchBySsNum(searchForm.getSsNum().trim());
    // Place search results in SearchForm for access
    by JSP.
    searchForm.setResults(results);
    // Forward control to this Action's input page.
    return mapping.getInputForward();
    <br> File Name : <b> EmployeeSearchService.java </b>
    package com.jamesholmes.minihr;
    import java.util.ArrayList;
    public class EmployeeSearchService
    /* Hard-coded sample data. Normally this would come
    from a real data
    source such as a database. */
    ivate static Employee[] employees =
    new Employee("Bob Davidson", "123-45-6789"),
    new Employee("Mary Williams", "987-65-4321"),
    new Employee("Jim Smith", "111-11-1111"),
    new Employee("Beverly Harris", "222-22-2222"),
    new Employee("Thomas Frank", "333-33-3333"),
    new Employee("Jim Davidson", "444-44-4444")
    // Search for employees by name.
    public ArrayList searchByName(String name) {
    ArrayList resultList = new ArrayList();
    for (int i = 0; i < employees.length; i++) {
    if
    (employees.getName().toUpperCase().indexOf(name.toU
    pperCase()) != -1) {
    resultList.add(employees[i]);
    return resultList;
    // Search for employee by social security number.
    public ArrayList searchBySsNum(String ssNum) {
    ArrayList resultList = new ArrayList();
    for (int i = 0; i < employees.length; i++) {
    if (employees[i].getSsNum().equals(ssNum)) {
    resultList.add(employees[i]);
    return resultList;
    <br> File Name : <b> Employee.java </b>
    package com.solversa;
    public class Employee
         private String name;
         private String ssNum;
         public Employee(String name, String ssNum) {
         this.name = name;
         this.ssNum = ssNum;
         public void setName(String name) {
         this.name = name;
         public String getName() {
         return name;
         public void setSsNum(String ssNum) {
         this.ssNum = ssNum;
         public String getSsNum() {
         return ssNum;
    Pls help me out.
    Not able to prompt errors.
    Hi,
    Your error message are not displaying because u does not made Message-Resoucrce property file (Resource Bundle) when you make it .
    give it entry in
    struts-config.xml
    <message-resources parameter="ApplicationResources" />
    and
    define key and corresponding error message to key in this ApplicationResources i.e
    #Error Resources
    label.search.ssNum=Plz Enter correct ssNum

  • How to get values from a table(in jsp) for validation using javascript.

    hi,
    this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
    thank you in advance.

    Yes i did try the same ..
    BEGIN
    select PROD_tYPE into :P185_OFF_CITY from
    magcrm_setup where atype = 'CITY' ;
    :p185_OFF_CITY := 'XXX';
    insert into mtest values ('inside foolter');
    END;
    When i checked the mtest table it shos me the row inserted...
    inside foolter .. Now this means everything did get execute properly
    But still the vallue of off_city is null or emtpy...
    i check the filed and still its empty..
    while mtest had those records..seems like some process is cleaining the values...but cant see such process...
    a bit confused..here..I tried on Load after footer...
    tried chaning the squence number of process ..but still it doesnt help
    some how the session variables gets changed...and it is changed to empty
    Edited by: pauljohny on Jan 3, 2012 2:01 AM
    Edited by: pauljohny on Jan 3, 2012 2:03 AM

  • Use Spry to insert data into a database?

    I'm new to Spry, so I have a question:
    Can I use Spry to insert data into a MySQL database without
    reloading the site?
    Reading data from XML file works fine, but I don't know if
    writing is possible..

    I don't get it... I tried this:
    <script type="text/javascript" src="spry/xpath.js"
    /></script>
    <script type="text/javascript" src="spry/SpryData.js"
    /></script>
    <script type="text/javascript">
    /* <![CDATA[ */
    function subscribe() {
    var subscribe;
    var info =
    document.getElementById("subscription_info").value;
    if (document.getElementsByName("subscription")[0].checked ==
    true) {
    subscribe = "ja";
    else {
    subscribe = "nein";
    var dsSubscribe = new
    Spry.Data.XMLDataSet("include/inc_subscribe.php?subscribe="+subscribe+"&info="+info+"&sit e=<?=$_GET['site'];?>",
    "subscription/ok");
    /* ]]> */
    </script>
    <div id="infos">
    <input type="radio" name="subscription" value="ja" />
    dabei
    <input type="radio" name="subscription" value="nein"
    /> nicht dabei
    <input type='text' class='text'
    id='subscription_info_text' />
    <input type='submit' id="subscription_submit"
    value='Eintragen' onClick="subscribe()" />
    </div>
    But the data isn't inserted into the mysql database. When I
    start the php script directly, it works, so I think it's not a php
    problem.

Maybe you are looking for

  • Can't install new version of iTunes or uninstall all of old version

    i posted this yesterday and saw it posted later but now my post is gone so here we go again. i can down load the application but wheni run the installer it quits and throughs up a message saying something like "can't delete old version of apple softw

  • REPORT ON CONTRACT/PO/GR COMBINATION

    HELLO EXPERTS, My requirement is like this.. i want to see all contract made for a particular material or particular vendor, and how many open order quantity is there. and if the PO is already made using that contact than whether goods is received ag

  • Error: "Could not resolve [public class] to a component implementation

    Here's another clueless newbie question! :-( I define a public class "DynamicTextArea" at the top of the file, and get the compiler error message "Could not resolve <DynamicTextArea> to a component implementation" at the bottom of the same file. Clea

  • Payment Advice does not exist- Lockbox Postprocessing

    SAP Guru's- I am unable to double click on the item to view the detail of postprocessing.  I thought that by checking the box in config under control parameters it fixed this problem.  I am in the test environment and I am unable to view the document

  • Redirecting between a desktop-browser site and a mobile site

    My company is inheriting a site built by another party in CQ5. This site is intended to be viewed on a desktop browser. We are tasked with building a mobile site for it. Our creative department would like the user's browser to be detected, and if the