Drop-Down List Default Values and Conditional Formatting - InfoPath Dev
in

InfoPath Dev

Drop-Down List Default Values and Conditional Formatting

Last post 10-28-2008 06:26 AM by Jeff3425. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 10-20-2008 09:05 AM

    Drop-Down List Default Values and Conditional Formatting

    Hello,

    I have a form where I have a drop down list connecting to an XML resource file.  In this list I have setup various conditional formatting options if certain values are selected.  I have also wanted to remove the default blank space that accompanies drop down lists.  I have found the way to extract the form files, and edit the XLS view to remove the <option/> tag so I can see the default values based on previous selections. However when I remove the <option/> tag it removes conditional formatting on the drop down list.  When I add the <optoin/> back in, the formatting comes back.  Adding to confusion further, is that without <option/> and blank value, formatting does comeback once I go to the drop down field and make a different selection.  Any thoughts?  Example below.

    Dropdown List with <option/> and formatting

    Value Formatting
    <blank>
    optional - Please Select yellow background
    Install green text
    Do Not Install red bold text

    Removing <Option/>
    Value Formatting
    optional - Please Select Default none/formatting after selecting)
    Install green text
    Do Not Install red bold text

    Desired result without <option/> in the view xls file

    Value Formatting
    optional - Please Select yellow background
    Install green text
    Do Not Install red bold text

  • 10-20-2008 11:11 PM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Hi,We cannot remove the blank value in drop down. But we can set an xml value as default value instead of blank value. In this case blank value will be displayed in the dropdown but by default first value will be selected when you open new form.1.    Go to data source in the task pane and Double click on dropdown field. 2.    Select Fx button for Default value. 3.    Select Insert field or group. 4.    Select secondary xml from data source. 5.    Select “value” and click on ok.Conditional formatting also will work in this case.

     

    Swathip
    www.ggktech.com
  • 10-21-2008 09:16 AM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Thank you for your quick response.  If I perform the steps you selected, anytime I open up the form to view (after submitting) the value ties back to the default value rather than keeping the value that was selected.   This was the primary reason I went away from setting the default value.

     Also, the blank value can be removed from the drop down by accessing the view xls file (after extracting the forms and removing the <option/> tag from the field-howeve, this removes the initial conditional formatting. 

    Any ways to get around the default value overwriting the selected value after submit?  Thanks again.

  • 10-21-2008 10:30 PM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Hi, To show the default only for a new document, first remove the default value from the field properties. Then place the following code line in onload event.If(thisXDocument.IsNew){thisXDocument.DOM.selectSingleNode("/my:myFields/my:Field1").text = "defaultValue";}Here field1 -> drop down list field

     

    Swathip
    www.ggktech.com
  • 10-22-2008 06:57 AM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Good morning and Thank you again. 

    I am using Vbscript - how would this convert to vbscript?  Thanks!

  • 10-22-2008 10:49 PM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Hi,

    if(XDocument.IsNew)

    {

    XDocument.DOM.selectSingleNode("xpath").text = "default value"

    }

    Swathip
    www.ggktech.com
  • 10-23-2008 12:36 AM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Hi,

    Please write the below lines code in VBScript . I hope it will help you.

    If XDocument.IsNew Then

    XDocument.DOM.selectSingleNode("xpath").text = "default value"

    End If

    Chandrakanth/GGKTech
  • 10-28-2008 06:26 AM In reply to

    Re: Drop-Down List Default Values and Conditional Formatting

    Thank you for your response.

    For "default value" I would like to have this equal the "xpath" value where the "xml resource(secondary source) field CONDITION1" and "Condition 2" apply but I can't seem to write out the code correctly to access the secondary source correctly

     

    Essentially I would like to place this in the code in vbscript, but the script sees problems in the format:

    xdXDocument:GetDOM("SecondaryXMLDataSource")/OfferingMaster/Server/Function/ServerTools/StdTools/XMLField[xdXDocument:get-DOM()/my:myFields/my:InfoPathField1 = ../../../XMLField1 and xdXDocument:get-DOM()/my:myFields/my:InfoPathField2= ../../../../XMLField2]

     For this, I am trying to set the data source under "myFields" to a default value but not clear out the actual field value on the form.

Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.