automatic fill inputs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

automatic fill inputs

Miroslav Polc
Hi,

I need help with one problem. I have a form with radio buttons with some values(1..5). After click on some vale, I fill input with this value. But I need on this event (click on radio button) fill one more input with predefined value and put it in some variable(this value is different for each line), because I need calculation like: radio button value * predefined value / sum of predefined values, see the picture sample . Now, I have to fill inputs in second columns manually, but I need it automatic like inputs in first column. My code is:

<xhtml:td>
<xxf:variable name="predefined-quantities" select="for $i in (1 to 5) return normalize-space(xs:string($i))" as="xs:string+"/>
        <xforms:select1 class="quantity-select" ref="quantity" appearance="full">
       
           <xforms:item>       
               <xforms:label>Nehodnotené</xforms:label>       
               <xforms:value value="0"/>   
           </xforms:item>
                                                               
        <xforms:itemset ref="$predefined-quantities">
             <xforms:label value="."/>
             <xforms:value value="."/>
        </xforms:itemset>
                               
         
         </xforms:select1>
</xhtml:td>
                       

<xhtml:td><xforms:input id="quantity-input" class="quantity-input" ref="quantity"/></xhtml:td>

What I should add to this code? I need some variable where i put predefined value and fill inputs.
Here is a .jsp file, its better I think. default.jsp

Thank for quick reply...
Reply | Threaded
Open this post in threaded view
|

Re: automatic fill inputs

Erik Bruchez
Administrator
You could try to do the computation in the model, something like this:

https://gist.github.com/2144774

Here I assumed values 1 to 3 and some weights for each position. Also,
all values are integers.

-Erik

On Tue, Mar 20, 2012 at 1:41 AM, Miroslav Polc <[hidden email]> wrote:

> Hi,
>
> I need help with one problem. I have a form with radio buttons with some
> values(1..5). After click on some vale, I fill input with this value. But I
> need on this event (click on radio button) fill one more input with
> predefined value and put it in some variable(this value is different for
> each line), because I need calculation like: radio button value * predefined
> value / sum of predefined values, see the picture
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n4488054/form.png  .
> Now, I have to fill inputs in second columns manually, but I need it
> automatic like inputs in first column. My code is:
>
> <xhtml:td>
> <xxf:variable name="predefined-quantities" select="for $i in (1 to 5) return
> normalize-space(xs:string($i))" as="xs:string+"/>
>        <xforms:select1 class="quantity-select" ref="quantity" appearance="full">
>
>           <xforms:item>
>               <xforms:label>Nehodnotené</xforms:label>
>               <xforms:value value="0"/>
>           </xforms:item>
>
>        <xforms:itemset ref="$predefined-quantities">
>             <xforms:label value="."/>
>             <xforms:value value="."/>
>        </xforms:itemset>
>
>
>         </xforms:select1>
> </xhtml:td>
>
>
> <xhtml:td><xforms:input id="quantity-input" class="quantity-input"
> ref="quantity"/></xhtml:td>
>
> What I should add to this code? I need some variable where i put predefined
> value and fill inputs.
> Here is a .jsp file, its better I think.
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n4488054/default.jsp
> default.jsp
>
> Thank for quick reply...
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/automatic-fill-inputs-tp4488054p4488054.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws