vazco / meteor-universe-autoform-select

Meteor universe autoform select
MIT License
16 stars 10 forks source link

Loading doc=this values when using the 'optionsMethod' #45

Closed DanceParty closed 4 years ago

DanceParty commented 7 years ago

I have a couple fields using universe-select and when loading an update form, the values using the options values load properly, but when using the optionsMethod, they are blank values, which would force the user to re-enter values that should already be present.

MichalW commented 7 years ago

You mean placeholder? It is option uniPlaceholder

DanceParty commented 7 years ago

would that work? Just passing through the current value for that collection item into that parameter?

If so, sorry for opening an issue. Thanks!

MichalW commented 7 years ago

I do not know if I understand your problem, first please try this option

DanceParty commented 7 years ago

Not sure this solved the problem.

Okay... I have a field People and that collection contains upwards of 3000 items in it. Because of this, I am using the optionsMethod and only passing through a few at a time (dependent on another field).

However, when I create an update form, all of my fields, except People are pre-populated (People should be populated with John Doe, but is instead blank) with the existing value (People is the only item using optionsMethod).

I just tried returning the value and label as a placeholder, thinking that would be a kind of work around

[
{ label: "john doe", value: "john doe" }
]

but that didnt work and just returns a placeholder [Object, object]

image

MichalW commented 7 years ago

placeholder need only label - just string

DanceParty commented 7 years ago

When they go to submit the update form, will it store the same value as before in that case?

For Example:

In the People insert form, I am using a label "First Name, Last Name", but the value is a Number ID

so if I pass only a String, I am curious as to how I can maintain the value (Number ID?)

DanceParty commented 7 years ago

To continue this, it seems as though the value is present but is hidden.

When the page loads, it is blank,

image

Even, when typing a new name, the selection remains blank,

image

However, when I select this new name, the original name plus the new name appear in the selection (I do not have multiple = true btw).

image

Any ideas?

MichalW commented 7 years ago

Please take a look at demo: http://universe-autoform-select.stg.vazco.eu/

There is placeholder on fields with remote options: image

DanceParty commented 7 years ago

Placeholder in these uses seems to be a global for the entire autoform. I am looking for it to show the currently in-use value for a specific afQuickField while using optionsMethod

Here is the form:

image

Here is what the form should be showing:

image

and here is the code

{{#autoForm collection="Equipment" doc=getEquipment id=updateEquipment type="update"}}

     {{> afQuickField name="Company" type="universe-select" options=companyOptions}}

     {{> afQuickField name="Employee" type="universe-select" optionsMethod="employeeEquipmentOptions" optionsMethodParams=employeeHelper}}

     {{> afQuickField name="Office" type="universe-select" options=officeOptions}}

{{/autoForm}}

If you notice, the only field not returning the value that is currently in use is the one using optionsMethod instead of options.

So when I go to update the form, I am forced to re-enter values that should be appearing in the first place.

kestarumper commented 4 years ago

We've decided to archive some of our repositories as we are no longer using nor willing to maintain them. Part of this process involves closing related issues and PRs. If you still need help, do contact us on opensource@vazco.eu.