Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4243556
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:35:37+00:00 2026-05-21T03:35:37+00:00

In an XForms form, I have a section that repeats with inputs inside of

  • 0

In an XForms form, I have a section that repeats with inputs inside of it. There is a dropdown that will populate in each repeated section and no two dropdowns can have the same value selected. Each dropdown must have a unique selection and if there is a duplicate selection between dropdowns in the seperate sections they should become invalid.

This is the idea I am going for

constraint="not(. = instance('my-instance')/repeated-section[Include everything BUT .'s parent]/dropdown)"

Sample Instance Data:

<repeated-section>
     <input1></input1>
     <input2></input2>
     <dropdown></dropdown>
     <input4></input4>
</repeated-section>    
<repeated-section>
     <input1></input1>
     <input2></input2>
     <dropdown></dropdown>
     <input4></input4>
</repeated-section>    
<repeated-section>
     <input1></input1>
     <input2></input2>
     <dropdown></dropdown>
     <input4></input4>
</repeated-section>

This is mainly an XPath filtering question. Is it possible to do what I am asking? I want to compare the current node (lets say the 2nd set of the repeated-section) against all other repeated nodesets (repeated-section 1 and 3), excluding the current nodeset (because if you compare against all including the self, it will of course be compared to as true).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:35:37+00:00Added an answer on May 21, 2026 at 3:35 am

    To simplify things, I assumed that you have just one element for each iteration of the repeat:

    <instance>
        <repeated-value>1</repeated-value>
        <repeated-value>2</repeated-value>
        <repeated-value>2</repeated-value>
    </instance>
    

    Then the constraint becomes:

    <xforms:bind ref="repeated-value" constraint="not(. = (../repeated-value except .))"/>
    

    One trick is in the except keyword, which allows you to build a sequence with all the “other repeat-value”. Then you want to know if any of those is equal to the current node, which you do with = operator. Finally, the node is valid, if you can’t find another node with the same value, hence the not(). Note that using not(… = …) is not the same as … != …. And here is a full example to try this out:

    <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
          xmlns:xforms="http://www.w3.org/2002/xforms"
          xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
          xmlns:ev="http://www.w3.org/2001/xml-events"
          xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
        <xhtml:head>
            <xhtml:title>No more than one</xhtml:title>
            <xforms:model>
                <xforms:instance>
                    <instance>
                        <repeated-value>1</repeated-value>
                        <repeated-value>2</repeated-value>
                        <repeated-value>2</repeated-value>
                    </instance>
                </xforms:instance>
                <xforms:bind ref="repeated-value" constraint="not(. = (../repeated-value except .))"/>
            </xforms:model>
            <xhtml:style type="text/css">
                .xforms-repeat-selected-item-1 { background: transparent }
                .xforms-input { display: block; padding-bottom: .5em  }
            </xhtml:style>
        </xhtml:head>
        <xhtml:body>
            <xforms:repeat ref="repeated-value">
                <xforms:input ref=".">
                    <xforms:alert>This value is repeated more than once</xforms:alert>
                </xforms:input>
            </xforms:repeat>
        </xhtml:body>
    </xhtml:html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A few years ago we started playing around with XForms from the W3C for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.