Login  Register

Re: Re: Re: SELECT1 javascript testing for checked value

Posted by Kalle Säilä on Nov 26, 2009; 9:45am
URL: https://discuss.orbeon.com/SELECT1-javascript-testing-for-checked-value-tp788098p788137.html

You could try something like this:

<xhtml:div>d. West - <xforms:select1 id="surroundingwest"
ref="surrounding/west" appearance="full">
                   
<xforms:choices><xforms:item><xforms:label>No
exposures within
50'</xforms:label><xforms:value>No</xforms:value></
xforms:item><xforms:item><xforms:label>Exposure
within
50'</xforms:label><xforms:value>Yes</xforms:value></xforms:item></
xforms:choices>
<xforms:action ev:event="xforms-value-changed">
<xxforms:script>
var value = ORBEON.xforms.Document.getValue('surroundingwest');
var myDiv = document.getElementById('surroundingwestcomment');
if(value == 'Yes') {
        myDiv.style.display = 'block';
} else {
        myDiv.style.display = 'none';
}
</xxforms:script>
</xforms:action>
</xforms:select1>
                    <xhtml:br/>

                   <xhtml:div id="surroundingwestcomment"
style="display:none;">
                    Explain: <xhtml:br/> <xforms:textarea
ref="surrounding/westexplain"
                                                incremental="true"  mediatype="text/html">
                                                <xforms:alert/>
                                        </xforms:textarea>
                   </xhtml:div>
                 </xhtml:div>

Didn't tested that so it might not work at all.

- Kalle

On 26.11.2009, at 11.24, JohnBampton wrote:

>
> Yeah i figured that out, but it doesn't work if mediatype is set
>
> That must be a bug.
>
> Any way around that with javascript?
>
>
> Kalle Säilä wrote:
>>
>> Sorry, the ref in textarea is now incorrect. Try this instead:
>>
>> <xforms:group ref="surrounding[west = 'Yes']">
>> <xhtml:div id="surroundingwestcomment">
>>                      Explain: <xhtml:br/> <xforms:textarea
>> ref="./westexplain"
>> incremental="true"  mediatype="text/html">
>> <xforms:alert/>
>> </xforms:textarea>
>>                     </xhtml:div>
>> </xforms:group>
>>
>> - Kalle
>>
>> On 26.11.2009, at 10.58, JohnBampton wrote:
>>
>>>
>>> Hi, it still doesn't show the textarea??  It only shows the word
>>> "Explain"
>>>
>>>
>>>
>>> Kalle Säilä wrote:
>>>>
>>>> How about:
>>>>
>>>> <xforms:group ref="surrounding/west[. = 'Yes']">
>>>> <xhtml:div id="surroundingwestcomment">
>>>>                     Explain: <xhtml:br/> <xforms:textarea
>>>> ref="surrounding/westexplain"
>>>> incremental="true"  mediatype="text/html">
>>>> <xforms:alert/>
>>>> </xforms:textarea>
>>>>                    </xhtml:div>
>>>> </xforms:group>
>>>>
>>>> - Kalle
>>>>
>>>> On 26.11.2009, at 10.42, JohnBampton wrote:
>>>>
>>>>>
>>>>> Hello, I have the following code and I only want to display the
>>>>> "surroundingwestcomment" div if the select1 is checked with  
>>>>> value of
>>>>> "Yes".
>>>>> So I need some javascript but I don't know what.  Any ideas?
>>>>>
>>>>> <xhtml:div>d. West - <xforms:select1 id="surroundingwest"
>>>>> ref="surrounding/west" appearance="full">
>>>>>                  
>>>>> <xforms:choices><xforms:item><xforms:label>No
>>>>> exposures within
>>>>> 50'</xforms:label><xforms:value>No</xforms:value></
>>>>> xforms:item><xforms:item><xforms:label>Exposure
>>>>> within
>>>>> 50'</xforms:label><xforms:value>Yes</xforms:value></xforms:item></
>>>>> xforms:choices>
>>>>> </xforms:select1>
>>>>>                    <xhtml:br/>
>>>>>
>>>>>                   <xhtml:div id="surroundingwestcomment"
>>>>> style="display:none;">
>>>>>                    Explain: <xhtml:br/> <xforms:textarea
>>>>> ref="surrounding/westexplain"
>>>>> incremental="true"  mediatype="text/html">
>>>>> <xforms:alert/>
>>>>> </xforms:textarea>
>>>>>                   </xhtml:div>
>>>>>                 </xhtml:div>
>>>>> --
>>>>> View this message in context:
>>>>> http://n4.nabble.com/SELECT1-javascript-testing-for-checked-value-tp788098p788098.html
>>>>> Sent from the ObjectWeb 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
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://n4.nabble.com/SELECT1-javascript-testing-for-checked-value-tp788098p788108.html
>>> Sent from the ObjectWeb 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
>>
>>
>
> --
> View this message in context: http://n4.nabble.com/SELECT1-javascript-testing-for-checked-value-tp788098p788120.html
> Sent from the ObjectWeb 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