Skip to content

Attribute values are not set to the instance value when editing a submission #646

@garethbowen

Description

@garethbowen

Expected Behaviour

Given a form with calculated attributes, when editing a submission the attributes should be set to the value of the original form submission.

Observed Behaviour

The attribute is blank.

Reproduction Steps

Form (XML or XLSX file):

<?xml version="1.0"?>
<h:html
	xmlns="http://www.w3.org/2002/xforms"
	xmlns:entities="http://www.opendatakit.org/xforms/entities"
	xmlns:ev="http://www.w3.org/2001/xml-events"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:jr="http://openrosa.org/javarosa"
	xmlns:odk="http://www.opendatakit.org/xforms"
	xmlns:orx="http://openrosa.org/xforms"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<h:head>
		<h:title>Neighborhood pet: add</h:title>
		<model entities:entities-version="2022.1.0" odk:xforms-version="1.0.0">
			<instance>
				<data id="pets_add" version="20231204203009">
					<species/>
					<name/>
					<block/>
					<meta>
						<instanceID/>
						<entity create="1" dataset="pets" id="">
							<label/>
						</entity>
					</meta>
				</data>
			</instance>
			<bind entities:saveto="species" nodeset="/data/species" required="true()" type="string"/>
			<bind nodeset="/data/name" required="true()" type="string"/>
			<bind entities:saveto="likely_block" nodeset="/data/block" type="string"/>
			<bind jr:preload="uid" nodeset="/data/meta/instanceID" readonly="true()" type="string"/>
			<bind calculate="1" nodeset="/data/meta/entity/@create" readonly="true()" type="string"/>
			<bind nodeset="/data/meta/entity/@id" readonly="true()" type="string"/>
			<setvalue event="odk-instance-first-load" readonly="true()" ref="/data/meta/entity/@id" type="string" value="uuid()"/>
			<bind calculate=" /data/name " nodeset="/data/meta/entity/label" readonly="true()" type="string"/>
		</model>
	</h:head>
	<h:body>
		<input ref="/data/species">
			<label>Species</label>
		</input>
		<input ref="/data/name">
			<label>Name</label>
		</input>
		<input ref="/data/block">
			<label>Likely block of residence</label>
		</input>
	</h:body>
</h:html>

Steps:

  1. Submit the form. Because the entity id is generated on odk-instance-first-load this gets set with a uuid.
  2. Edit the form.
  3. Submit the form again. The entity id should be the same as the value in 1. It's actually blank.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions