You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the PromptDialog only accepts one value. There should be an array that can be submitted in the "value" field, and then the done() callback function can do a loop through the results.
ex:
core.make('osjs/dialog', 'prompt', {
message: `Type in your name:`,
value: ['First Name', 'Last Name']
}, done(value => {...}
Would you need to know the type of value expected? i.e. string, or numeric so a spinner can be thrown in. Or a drop-down list of choices? Just thinking out loud here.
Another thought.. what about a dialog that asks the user to select from a series of images? Yeah, I'm getting ahead of myself here, just thinking of the possibilities.
Another thought.. what about a dialog that asks the user to select from a series of images? Yeah, I'm getting ahead of myself here, just thinking of the possibilities.
You can implement custom dialogs both globally and programatically.
If it's just application spesific, a custom Window is probably good enough.
In your example above, the "true" is related to the option field? Just making sure I'm following, if the user selects an option, the result would be "true" that an option was selected? Or would the result be the choice title/index/value selected?
Here's an exaple of how to create a custom dialog on runtime (programatically) w/standard dialog interface/base class:
constcallback=(btn,value,dialog)=>{console.log(btn,value)};core.make('osjs/dialogs').create({buttons: ['ok'],window: {title: 'My Dialog',dimension: {width: 400,height: 400}}},(dialog)=>{// The callback for getting dialog valuereturndialog.app.getValue();},callback).render(($content,dialogWindow,dialog)=>{dialog.app=app({// Your local dialog statevalue: 0},{// Your local dialog actionssetValue: value=>({value}),getValue: ()=>state=>state.value},(state,actions)=>dialog.createView([// Your local dialog viewh(RangeField,{min: 0,max: 100,onchange: (ev,value)=>actions.setValue(value)})]),$content);});
I haven't used JSX -- but you probably get the idea
In your example above, the "true" is related to the option field? Just making sure I'm following, if the user selects an option, the result would be "true" that an option was selected? Or would the result be the choice title/index/value selected?
The array of values was defined in the same order as inputs so they could be mapped over when the UI was created. Maybe that's confusing ?
Your custom example is good as well, and thought about using that for more complex stuff. But, for simple and quick prompts, I like the code you posted with inputs: [].
Don't forget t update documentation accordingly, to show single input prompt and multiple inputs prompt. Assuming single input would remain the same as it is now.
Just thought of it, I know you have authentication prompt, but for this. What if a user is required to enter a code that they don't want to be visible, i.e. using the password prompt for some private user code. Please include type: "PasswordField" if you haven't done so already. I'm guessing you're going to have TextField, TextArea, PasswordField, OptionField, etc... ?
Activity
aherreraGH commentedon Dec 17, 2018
Would you need to know the type of value expected? i.e. string, or numeric so a spinner can be thrown in. Or a drop-down list of choices? Just thinking out loud here.
Another thought.. what about a dialog that asks the user to select from a series of images? Yeah, I'm getting ahead of myself here, just thinking of the possibilities.
andersevenrud commentedon Dec 17, 2018
Another thing that could be added is generic inputs, not just text fields:
Maybe something like this ?
andersevenrud commentedon Dec 17, 2018
You can implement custom dialogs both globally and programatically.
If it's just application spesific, a custom Window is probably good enough.
aherreraGH commentedon Dec 17, 2018
Yeah, I think so.
understood
aherreraGH commentedon Dec 17, 2018
In your example above, the "true" is related to the option field? Just making sure I'm following, if the user selects an option, the result would be "true" that an option was selected? Or would the result be the choice title/index/value selected?
Tried to bold the word true.
andersevenrud commentedon Dec 17, 2018
Here's an exaple of how to create a custom dialog on runtime (programatically) w/standard dialog interface/base class:
I haven't used JSX -- but you probably get the idea
andersevenrud commentedon Dec 17, 2018
The array of
value
s was defined in the same order asinputs
so they could be mapped over when the UI was created. Maybe that's confusing ?aherreraGH commentedon Dec 17, 2018
I understand the order. I guess I got confused. So, value is the text that would show up as the label for the input field, correct?
default text: [ ]
Or how would I set the label, in your example?
andersevenrud commentedon Dec 17, 2018
An entry in
values
is what would show up in the correspondinginputs
field, yes.Labels could probably added like this:
aherreraGH commentedon Dec 17, 2018
Your custom example is good as well, and thought about using that for more complex stuff. But, for simple and quick prompts, I like the code you posted with
inputs: []
.aherreraGH commentedon Dec 17, 2018
Don't forget t update documentation accordingly, to show single input prompt and multiple inputs prompt. Assuming single input would remain the same as it is now.
aherreraGH commentedon Dec 17, 2018
Just thought of it, I know you have authentication prompt, but for this. What if a user is required to enter a code that they don't want to be visible, i.e. using the password prompt for some private user code. Please include type: "PasswordField" if you haven't done so already. I'm guessing you're going to have TextField, TextArea, PasswordField, OptionField, etc... ?
andersevenrud commentedon Dec 17, 2018
TextField
is just a wrapper around<input />
, so thetype
attribute is valid here.aherreraGH commentedon Dec 17, 2018
ooh. understood.