[Xerte] Re: Xerte 2 : Combo box value is defaulting to "" why?

Julian Tenney Julian.Tenney at nottingham.ac.uk
Mon Apr 11 16:03:07 BST 2011


You need to add the default value to the value in options, not data.

So in this case default="On user request"

From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Kemp Johnathan
Sent: 11 April 2011 15:11
To: Xerte discussion list
Subject: [Xerte] Re: Xerte 2 : Combo box value is defaulting to "" why?

Given the xwd file content as

<wizard>
<!--GAP FILL INTERACTION-------------------------------------------------------->
<gapFill hint="An interaction for creating a drag and drop gap-fill exercise.">

<text type="TextArea" height="100" label="Introductory Text"/>
<passage type="TextArea" height="150" label="Gap Fill Text"/>
<interactivity type="ComboBox" label="Interactivity" options="Drag Drop,Fill in Blank" width="100"/>
<feedback type="TextArea" height="50" label="Feedback"/>
<panelWidth type="ComboBox" label="Panel Width" options="Small,Medium,Large,Full" width="100"/>

<narration type="media" label="Narration" optional="true"/>
<narPlayback type="ComboBox" label="Narration Playback" options="On user request,On page load" data="userRequest,pageLoad" width="150" optional="true"/>
<noise type="TextArea" height="50" label="Distractors" optional="true"/>
</gapFill>

</wizard>

If the optional parameter Narration Playback is not added then narPlayback has a value of undefined

If the optional parameter Narration Playback is added then narPlayback has a value of ""

Only once a combo box option other than the first option is selected by the user does narPlayback get a value from the data list. So to actually give narPlayback a value of "userRequest" the user would have to select first the option "On page load" (giving narPlayback a value of "pageLoad"), then select the option "On user request" (giving narPlayback the value of "userRequest")

If the parameter was not an optional one then a value could be supplied in the xml file which would then act as the default value. Since the parameter is optional this is not appropriate.

I tried adding a parameter to the xwd declaration default="userRequest" but this did not do anything.

Kind regards

Johnathan

On 11 April 2011 11:00, Julian Tenney <Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>> wrote:
If you add the default value in the .xwd then that should be the value the property is instantiated in the xml as. You should always get a valid value, even if you don't touch the drop down at all.

No?

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk>] On Behalf Of Kemp Johnathan
Sent: 06 April 2011 17:28

To: Xerte discussion list
Subject: [Xerte] Re: Xerte 2 : Combo box value is defaulting to "" why?

"I think default should be On Page Load (the label) rather than pageLoad (the data)."

I interpreted (perhaps incorrectly) that what you were saying here was that rather than trying to pass a default value from the xwd file, I should include in the script that received the data e.g. getPageID code to test for a null value.

Since I was setting up a combo box to allow a user to select between playing narration on page load or on user request I simply changed the order of the options around so that playing on page load was the second option. Action only needed to be taken if the second option was selected and selecting the second option always returned the same value (whereas selecting the first option might return "" or "onUserRequest". So it just kept the testing simpler.

My experience during testing was that with respect to a combo box specifying an optional property
1. No optional property added : property value = undefined.
2. Optional property added and wizard closed without selection of a value : property value = ""
3. Optional property added and first option selected : property value = ""
4. Optional property added and second option selected : property value = "second option value"
5. Optional property added and second option selected then first option selected : property value = "first option value"

Kind regards

Johnathan

On 6 April 2011 16:21, Julian Tenney <Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>> wrote:
Can do that, yes, if it doesn't already work? I know some controls take default values, precisely because when an optional attribute is added, it adds a null value: did you try what I suggested? This code from the wizard suggest all optional properties will handle a default value.

//add optional properties
addPropListener = new Object();
addPropListener.click = function(obj){

       if (wizard.nfoObject.wizard[tree.selectedNode.nodeName][optProps.selectedItem.data].defaultValue != undefined){
              tree.selectedNode.attributes[optProps.selectedItem.data] = wizard.nfoObject.wizard[tree.selectedNode.nodeName][optProps.selectedItem.data].defaultValue;
       } else {
              tree.selectedNode.attributes[optProps.selectedItem.data] = ""
       }
       tree.dispatchEvent({target:tree, type: "change"});
}
addProp.addEventListener('click', addPropListener);

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk>] On Behalf Of Kemp Johnathan
Sent: 06 April 2011 15:29
To: Xerte discussion list
Subject: [Xerte] Re: Xerte 2 : Combo box value is defaulting to "" why?

Thanks for your help.

It seems strange to me that a combo box / drop down menu should default to returning "" rather than the value of the first element in the list.

Since the xwd file provides the data for the construction of the wizard, I guess the behaviour of the wizard is governed by the code that processes the xwd file and presents the wizard form to the user, and that this is a part of the core Xerte code. Would it be possible to update the code so that a combo box when run could have either a default value specified in the xwd file or alternatively that it just defaulted to returning the value of the first item in the list unless one of the other items had been selected?

Kind regards

Johnathan

On 5 April 2011 15:09, Julian Tenney <Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>> wrote:
I think default should be On Page Load (the label) rather than pageLoad (the data).

From: xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk> [mailto:xerte-bounces at lists.nottingham.ac.uk<mailto:xerte-bounces at lists.nottingham.ac.uk>] On Behalf Of Kemp Johnathan
Sent: 05 April 2011 15:07
To: Xerte discussion list
Subject: [Xerte] Xerte 2 : Combo box value is defaulting to "" why?

Hello Xerte team,

As far as I can tell this line is set up like many other optional property lines and I don't recall hitting this problem before

In an xwd file I have the optional property

<narPlayback type="ComboBox" label="Narration Playback" options="On page load,On user request" data="pageLoad,userRequest" default="pageLoad" width="150" optional="true"/>
When the page wizard is opened and the Narration Playback property added and the page wizard closed, the value of narPlayback changes from undefined to ""
If the page wizard is re-opened the combo box displays the selected value as "On page load".
Clicking on the value "On page load" does not change the value from "" to "pageLoad".

The only way I can actually set the value of narPlayback to "pageLoad" is to select the alternative option from the combo box i.e. "On user request" and then to select "On page load"

What am I missing here?
What do I need to do to ensure that when the optional property is added it receives the default value of "pageLoad"?

Kind regards

Johnathan


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>
http://lists.nottingham.ac.uk/mailman/listinfo/xerte

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>
http://lists.nottingham.ac.uk/mailman/listinfo/xerte

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk<mailto:Xerte at lists.nottingham.ac.uk>
http://lists.nottingham.ac.uk/mailman/listinfo/xerte

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110411/08ec8ebb/attachment-0001.html>


More information about the Xerte mailing list