W3C home > Mailing lists > Public > www-forms@w3.org > January 2006

RE: setting a default value (setvalue)

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Tue, 17 Jan 2006 13:10:00 -0000
Message-ID: <0C8DD334-BC80-489E-B437-707513889BA3@s15.mail.x-port.net>
To: <www-forms@w3.org>

Jason,

First, your xf:setvalue is never 'called'--the xf:insert is registered for
the DOMActivate event, but xf:setvalue is not. So you'll need to create an
xf:action with @ev:event set on it, and put both xf:insert and xf:setvalue
inside it.

Second, your XPath to my:HighCurrentProducts is probably wrong; judging by
the rest of the form it needs to be:

  my:group8/my:Highlight/my:HighCurrentProducts

Finally--and this is purely about style--do you realise you will get a new
table for each iteration of the xf:repeat?

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/

Download our XForms processor from
http://www.formsPlayer.com/  

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Jason Bailey
> Sent: 17 January 2006 11:19
> To: www-forms@w3.org
> Subject: setting a default value (setvalue)
> 
> 
> 
> Hello,
> I'm wondering if anyone can spot my mistake. I'm trying to 
> set some initial values on a repeated textarea. The repeated 
> area appears but the initial instance data does not get 
> overwritten by the setvalue.
> I'm viewing my xforms with firefox 1.5 and xforms beta 0.2
> 
> I'm using php to produce some of the xform drop downs. The 
> xml data is based on an infopath form; hence the my 
> namespace. I've moved the insert trigger about and am not 
> sure if this is the cause?
> 
> Thanks
> Jason
> 
> The xforms is....
> 
> 
> 	  <xforms:trigger>
>   <xforms:label>Insert</xforms:label>
> 
>   <xforms:insert nodeset="my:group8/my:Highlight" at="1" 
> position="before" 
> ev:event="DOMActivate"/>
> <xforms:setvalue ref="my:HighCurrentProducts">XXXX</xforms:setvalue>
> 
> </xforms:trigger>
>   <xforms:repeat nodeset="my:group8/my:Highlight" id="r1">
> 	
> 	  <table>
> 	  <tr>
> 	
> 	
> 	  <td>
> 	  <xforms:label >Report from:</xforms:label>
> 	  <xforms:input ref="my:highFrom">
> 
>       </xforms:input>
> 	   <xforms:label >Report to:</xforms:label>
> 	  <xforms:input ref="my:highTo">
> 
>       </xforms:input></td>
> 	
> 	
> 	  </tr>
> 	
> 	  <tr>
> 	  <td>
> 	  <xforms:label>Current Products</xforms:label>
> 	  <xforms:textarea ref="my:HighCurrentProducts" >
> 
>       </xforms:textarea>
> 	
> 	  </td>
> 	
> 	
> 	  </tr>
> 	
> 	  <tr>
> 	  <td>
> 	  <xforms:label>Next Products</xforms:label>
> 	  <xforms:textarea ref="my:HighNextPeriod" >
> 
>       </xforms:textarea>
> 	
> 	
> 	  </td>
> 	
> 	
> 	
> 	  </tr>
> 	
> 	  <tr>
> 	  <td>
> 	
> 	  <?php $drop1=new DropDown();
> 	  $value_array=$drop1->create_aheadbehind();
> 	 // print_r($value_array);
> 	
> 	
> 	
> 	  $label="Schedule Status";
> 	  $ref="my:HighScheduleStatus";
> 	  $namespace="xforms";
>  
> $drop11=$drop1->call_select1($label,$ref,$value_array,$default
> ,$namespace)
> 	
> 	  ?>
> 	  <xforms:label >by</xforms:label>
> 	    <xforms:input ref="my:HighScheduleStatusPer">
> 
>       </xforms:input>
> 	
> 	
> 	
> 	  <?php $drop2=new DropDown();
> 	  $value_array=$drop2->create_dwm();
> 	 // print_r($value_array);
> 	
> 	
> 	
> 	  $label=" ";
> 	  $ref="my:HighScheduleUnits";
> 	  $namespace="xforms";
>  
> $drop11=$drop1->call_select1($label,$ref,$value_array,$default
> ,$namespace)
> 	
> 	  ?>
> 	
> 	  	
> 	
> 	  </td>
> 	
> 	
> 	  </tr>
> 	  <tr>
> 	  <td>
> 	
> 	  <?php $drop3=new DropDown();
> 	  $value_array=$drop2->create_overunder();
> 	
> 	  $label="Budget Status";
> 	  $ref="my:HighBudgetStatus";
> 	  $namespace="xforms";
>  
> $drop11=$drop1->call_select1($label,$ref,$value_array,$default
> ,$namespace)
> 	
> 	  ?>
> 	
> 	
> 	
> 	
> 	  	   <xforms:label >by (%)</xforms:label>
> 	  <xforms:input ref="my:HighBudgetPer">
> 
>       </xforms:input>
> 	
> 	
> 	</td>
> 	
> 	  </tr>
> 	
> 	  </table>
> 	
> 	
> 	
> 	  </xforms:repeat>
> 
> 
> 	
> 	
> 
> 
> <xforms:trigger>
>   <xforms:label>Delete Section</xforms:label>
>   <xforms:delete nodeset="my:group8/my:Highlight" at="1" 
> position="before" 
> ev:event="DOMActivate"/>
> </xforms:trigger>
> 
> 
> 
> 
Received on Tuesday, 17 January 2006 13:10:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:02 GMT