Login  Register

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

Posted by JohnBampton on Nov 26, 2009; 10:18am
URL: https://discuss.orbeon.com/SELECT1-javascript-testing-for-checked-value-tp788098p788151.html

You guru, thanks a lot - my boss will be happy now



Kalle Säilä wrote
It seems that with Orebon javaScript functions you must reference to  
xforms:input instead of xforms:select1. I tested this and it worked:

<xhtml:div>
<xforms:input id="hidden-input" ref="surrounding/west" style="display:  
none;" />
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('hidden-input');
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>

- Kalle

On 26.11.2009, at 11.58, JohnBampton wrote:

>
> NO that doesn't work?  Any other ideas?
>
>
>
> Kalle Säilä wrote:
>>
>> 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 ops-
>>>>>>> users@ow2.org
>>>>>>> mailing list.
>>>>>>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>>>>>>> For general help: mailto:sympa@ow2.org?subject=help
>>>>>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You receive this message as a subscriber of the ops-users@ow2.org
>>>>>> mailing
>>>>>> list.
>>>>>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>>>>>> For general help: mailto:sympa@ow2.org?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 ops-users@ow2.org
>>>>> mailing list.
>>>>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>>>>> For general help: mailto:sympa@ow2.org?subject=help
>>>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>>>
>>>>
>>>>
>>>> --
>>>> You receive this message as a subscriber of the ops-users@ow2.org
>>>> mailing
>>>> list.
>>>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>>>> For general help: mailto:sympa@ow2.org?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 ops-users@ow2.org
>>> mailing list.
>>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>>> For general help: mailto:sympa@ow2.org?subject=help
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>>
>> --
>> You receive this message as a subscriber of the ops-users@ow2.org  
>> mailing
>> list.
>> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
>> For general help: mailto:sympa@ow2.org?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-tp788098p788142.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
> --
> You receive this message as a subscriber of the ops-users@ow2.org  
> mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
> For general help: mailto:sympa@ow2.org?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws



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