question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic form setting initial values

See original GitHub issue

Once we load the xml string and build the form can we load some initial values. e.g. Patient name and date of birth in this case.

CompiledDefinition = FormBuilder.Default.GetDefinition(xmlString); Maybe the returned CompiledDefinition can have the ExpandoObject which we can modify and call something like CompiledDefinition.Reload()

<form>
  <title>ULTRASOUND WORKSHEET ABDOMEN</title>
  <heading>Patient details</heading>
  <row>
    <col width="2">
 
    
        <input type="string" name="FirstName" label="Patient name" tooltip="Enter your name here."  >
      <validate must="NotBeEmpty" />
   </input>
  
    </col>
    <col>
   
        <input type="datetime?" name="DateOfBirth" label="Date of birth" icon="calendar" conversionError="Invalid date string.">
      <validate must="NotBeEmpty" />
      <validate must="BeLessThan" value="2020-01-01">You said you are born in the year {Value:yyyy}. Are you really from the future?</validate>
   </input>
 
    </col>
  </row>
  <row>
    <col width="2">
     <input type="datetime?" name="AppointmentDate" label="Date" icon="calendar" conversionError="Invalid date string." /> 
    </col>
    <col> 
         <input type="string" name="Age" label="Age" > 
   </input> 
    </col>
  </row>

 <heading>Findings</heading>

  <row>
        <input type="string" name="RightKidney" label="Right Kidney" ></input>
  </row>
  <row>
    <input type="string" name="LeftKidney" label="Left Kidney" ></input>
  </row>
  <row>
    <col>
      <row>
        <col>
          <text>Bladder</text>
        </col>
        <col>
          <input type="string" name="BladderVol" label="Bladder Vol (mm)" ></input>
        </col>
      </row>
      <row>
        <col>
          <text>Post Mkt.</text>
        </col>
        <col>
          <row>
            <text>VOL</text>
            <input />
          </row>
        </col>
      </row>
      <row>
        <col>
          <text>Prostate:</text>
        </col>
        <col>
          <row>
            <text>VOL</text>
            <input />
          </row>
        </col>
      </row>
      <row>
        <col>
          <text>Ureteric Jets:</text>
        </col>
        <col>
          <input />
        </col>
      </row>
      <br />
      <heading>Female</heading>
      <row>
        <col>
          <text>Uterus</text>
        </col>
        <col>
          <input />
        </col>
      </row>
      <row>
        <col>
          <text>Endromet.</text>
        </col>
        <col>
          <input />
        </col>
      </row>
      <row>
        <col>
          <text>Rt. Ovary</text>
        </col>
        <col>
          <input />
        </col>
      </row>
      <row>
        <col>
          <text>Left Ovary</text>
        </col>
        <col>
          <input />
        </col>
      </row>
    </col>
    <col>
      <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/KidneyStructures_PioM.svg/590px-KidneyStructures_PioM.svg.png" />
    </col>
  </row>
  <row>
    <text>Comments</text>
    <input />
  </row>
</form>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
hashithacommented, Jun 4, 2018

The context works fine. Will let you know if I run into any issues

0reactions
edongashicommented, Jun 4, 2018

JSON can now be viewed in XML demo route:

image

This will make life easier to inspect and debug the model values.

About the resources, I did some experiments and ended up with something like the context again… I think it’s good as it is. We can provide utilities and guidelines for easier usage of that mechanism.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting initial values to dynamic form in antd 4
I want to use dynamic form to edit object which already has some values. In this sandbox I created a new array of...
Read more >
AntDesign: InitialValues on Dynamic Form
Explore this online AntDesign: InitialValues on Dynamic Form sandbox and experiment with it yourself using our interactive online playground.
Read more >
Dynamic Form Item with default values · Issue #26204
When changing the initialValues, it doesn't change the current value of the form. Usually, when i'm dealing with an async call to populate...
Read more >
Setting Field Default Values Dynamically
Caldera Forms provides many ways to set the default value of a field dynamically. ... The simples method is to use the a...
Read more >
Ant design form input default values and dynamic values? |
Set default value in ant form input using initialValues <Form onFinish={handleUpdate} initialValues={{ name: updatingCategory.name, }} > Set dynamic value ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found