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 7946993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:18:19+00:00 2026-06-04T01:18:19+00:00

I want to perform some logic in JavaScript when users click on the span

  • 0

I want to perform some logic in JavaScript when users click on the span element and update current XML instance from jQuery:

(I have seen 2 similar questions online but they never got answered!)

XForms:

<xhtml:span class="buttonPlusOne" id="plusVat">+</xhtml:span>
<xf:output ref="instance('submitted_instance')/TotVATAmnt"></xf:output>
<xf:input id="changeVatTotal" ref="instance('submitted_instance')/TotVATAmnt"></xf:input>

JavaScript:

$('span.buttonPlusOne').on('click', function () {
    // do some logic and increment value for 0.01
    orbeonElId = $(this).siblings('#changeVatTotal').children('input').attr('id');
    // alert(orbeonElId) produces right id (changeVatTotal$xforms-input-1)
    // alert(newValue) produces 0.02 (for example)
    ORBEON.xforms.Document.setValue(orbeonElId, newValue);
});

I can see Orbeon posting data (Firebug), but the XML Instance does not get updated (input does not update the output – even though they share same “ref” attribute).

  • 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-06-04T01:18:20+00:00Added an answer on June 4, 2026 at 1:18 am

    I suppose that you’re mixing up the html element’s id with the XForms id (id attribute) of the xf:input element.

    The Orbeon documentation shows an example: the id to use in the ORBEON.xforms.Document.setValue() function call is the id of the (server-side) XForms element. So in your example it’s changeVatTotal, and not the id of the (client-side) html input element changeVatTotal$xforms-input-1. This is why there’s a request showing up in firebug with no effect on the XForms instance: the server-side XForms engine doesn’t find a xf:input element with the id changeVatTotal$xforms-input-1, so it doesn’t know what to do with that request.

    This means, too, that you (usually) don’t need to compute the id of the target element, instead you can just use the “plain” XForms id attribute value of the xf:input.

    Alternatively:

    Is it possible to handle the “plus” button completely in XForms? You could use a xforms:trigger control and include a xforms:setvalue action on the DOMActivate event:

    <xf:trigger>
        <xf:label>+</xf:label>
        <xf:setvalue
            ev:event="DOMActivate"
            ref="instance('submitted_instance')/TotVATAmnt"
            value="0.01 + instance('submitted_instance')/TotVATAmnt" />
        <.... more actions ...>
    </xf:trigger>
    

    I think this solution would be more stable than doing some of the work client-side and some server-side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to perform some logic within a callback function based
What do I want to achieve: I want to perform some time consuming operations
I have a table on which I want to perform some operations every hour.
I want to create a simple batch file that would perform some Visual Studio
Scenario: Retrieve some entities Update some properties on those entities You perform some sort
I have a LinkButton that has to postback to perform some logic. Once it
I am using SAX to parse some large XML files and I want to
I want to save to a log file some SQL query rails performs, (namely
I want perform a easy task in android, which when receiving a call the
I want to perform rubyf action in VIM when I press F5 if the

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.