Reuse sp.field already put/set into a form

Hello everyone,

I have a SP column (sp.field) which is question1 and this question1 appeared if conditions are true, with accordion1children0 hidden function, right.

BUT! this question1 is also usefully for accordion1children1.

Still, I can't duplicate sp.field into my form.

How do I build/set an other field to update the same sp column (question1) ?

Hello,

I've read this :
Change drop down field data source — Plumsail SharePoint Forms Documentation

So, I use a common field to "copy" the same question (sp.field already used in the form) :

1 = I put "typepurchase" required in js
2 = select answer, example "Choice 2" then
3 = click on "success" button, and it save and return to the list

I tried this code :


fd.spRendered(() => {
    //hide toolbar
    fd.toolbar.hidden = true;
      
    //make field required
    fd.field('typepurchase').required = true;
    
    //fill SharePoint field with the selected value, ifnew = sp.field of question1 duplicated

    fd.field('ifnew').value = fd.field("DropDown1").value;
    
    
});

when clicking on "success" button, it return any answers, it remain blank into Question1 sp.field (original one).

It doesn't work and don't know why.. :confused: any ideas pls ?

Hi @lolopixxx,

You can use this code to ensure that the values of a SharePoint field and a common field are always equal:

fd.spRendered(() => {
    fd.field('FieldA').$on('change', (value) => {
        fd.field('FieldB').value = value;
    });
    fd.field('FieldB').$on('change', (value) => {
        fd.field('FieldA').value = value;
    });
});

Hello @IliaLazarevskii !! :slight_smile:

It's working perfectky, thanks !