Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Problem in same text box for output and input value

$
0
0

@adithya.nagaraj wrote:

Hi all , I am trying to put a text that may show some value or it may input value depending upon the situation in the text box.
I have written a code in which the text-box is not displaying which i have mentioned in the callback

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State

import pandas as pd
from jira import JIRA

external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
app = dash.Dash(name, external_stylesheets=external_stylesheets)

app.layout = html.Div([
dcc.Input(id=‘input-1-state’, type=‘text’, value=’’),
html.Br(),
html.Br(),
html.Button(id=‘submit-button’, n_clicks=0, children=‘Submit’),
html.Div(id=‘area’,children=[dcc.Textarea(id=“output-textarea1”,placeholder=’’,value=‘11111’,style={‘width’: ‘100%’})]),
dcc.Textarea(id=“output-textarea2”,placeholder=’’,value=‘2222222’,style={‘width’: ‘100%’}),

dcc.Textarea(id=“output-textarea”,placeholder=’’,value=’’,style={‘width’: ‘100%’})

])

@app.callback(#dash.dependencies.Output(‘textarea’, ‘value’),
dash.dependencies.Output(‘area’, ‘children’),
[dash.dependencies.Input(‘submit-button’, ‘n_clicks’),
dash.dependencies.Input(‘input-1-state’, ‘value’)])
def update_output(n_clicks, input1):
if n_clicks > 0:
result = html.Div([dcc.Textarea(id=“output-textarea2”,placeholder=’’,value=‘hhhhhh’,style={‘width’: ‘100%’})])
return result

if name == ‘main’:
app.run_server(debug=True)

In the above code the value ‘2222222’ never display only .
this text box is appear only after i click on submit button with the value of ‘hhhhhh’.
Please let me know where i am going wrong .
And one more thing is can i place a component (like text box) in both output and input in callback ?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles