Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend to show enum values #246

Merged
merged 1 commit into from
Sep 4, 2019
Merged

Conversation

coreyfournier
Copy link
Contributor

@coreyfournier coreyfournier commented Aug 23, 2019

Updated the binding of changes when using a legend. Changes were not reflected when the text field was using an enum unless you used they keyboard to scroll through the different options. Below is a sample form that has a legend with an array and text enum. Verified this works with an existing legend that is tied to a standard text box.

{
	"schema": {
	    "coverages":
	    {
	        "type":"array",
	        "items":{
				"type": "object",
				"title":"Max Coverage",
				"properties": {
					"name":{
						"type":"string",
						"title":"Coverage Name",
						"required":true,
						"enum":["","NPPA","MDDO","Scribe"]
					},
					"hours": {
						"type": "number",
						"title": "Coverage (Hours)",
						"required":true,
						"step":1
					}
				}				
	        }
		}		
	},
	"form": [
		{
		  "type": "tabarray",
		  "items": {
			"type": "section",
			"legend":"{{value}}",
			"items": [
				{
				  "key": "coverages[].name",
				  "title": "Coverage Name",
				  "valueInLegend": true
				},
				"coverages[].hours",
				{
      "type": "submit",
      "title": "Submit"
    } 
			]
		  }
		}
	]
}

Updated the binding of changes when using a legend. Changes were not reflected when the text field was using an enum unless you used they keyboard to scroll through the different options. Below is a sample form that has a legend with an array and text enum. Verified this works with an existing legend that is tied to a standard text box.

{
	"schema": {
	    "coverages":
	    {
	        "type":"array",
	        "items":{
				"type": "object",
				"title":"Max Coverage",
				"properties": {
					"name":{
						"type":"string",
						"title":"Coverage Name",
						"required":true,
						"enum":["","NPPA","MDDO","Scribe"]
					},
					"hours": {
						"type": "number",
						"title": "Coverage (Hours)",
						"required":true,
						"step":1
					}
				}				
	        }
		}		
	},
	"form": [
		{
		  "type": "tabarray",
		  "items": {
			"type": "section",
			"legend":"{{value}}",
			"items": [
				{
				  "key": "coverages[].name",
				  "title": "Coverage Name",
				  "valueInLegend": true
				},
				"coverages[].hours",
				{
      "type": "submit",
      "title": "Submit"
    } 
			]
		  }
		}
	]
}
@tchapi
Copy link
Member

tchapi commented Sep 4, 2019

Hi @coreyfournier and thanks for this PR !
Sorry for the delay, I was afk for a while this summer.

There is just a small indentation issue with your change, could you correct it ? I'll merge the PR after that.

Thanks

@coreyfournier
Copy link
Contributor Author

coreyfournier commented Sep 4, 2019 via email

@tchapi tchapi merged commit 53bafc0 into jsonform:master Sep 4, 2019
@tchapi
Copy link
Member

tchapi commented Sep 4, 2019

Ok don't worry, I'll recheck that later. Thanks again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants