Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #102671
    Joko Pitoyo
    Participant

    i create form from json

     

    <smart-form id=’formA’></smart-form>

     

    const formA=new Smart.Form(‘#formA’,{

    controls:[{

    type:’group’,label:’Basic Info’,

    controls:{[label:’Name’,controlType:’input’,dataField:’name’]}

    }]

    });

     

    set individial value not working

     

    formA.setValue(‘name’,’Andrew’); //this not working

    formA.getControl(‘name’).value=’Andrew’; not working

    formA.controls[0].controls[0].value=’Andrew’; // this not working

    `

    so what the right way to set individial control created by JSON

    • This topic was modified 2 years, 4 months ago by Joko Pitoyo.
    #102673
    admin
    Keymaster

    Hi,

    This example shows how to set Form’s value: https://www.htmlelements.com/demos/form/template/. The ‘value’ property and setValue method expect a JSON object which matches the form’s structure. The patchValue method can be used for updating an individual component of a form. In the provided code, the ‘group’ control should have a dataField property set, too.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

    #102675
    Joko Pitoyo
    Participant

    hi

    thank for answe…

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.