Set value of Component TextArea in FormAction
Hello, how can i change the value of a TextArea when a button is pressed? Currently have this code in the class that extends CreateRecord but the ->value() function doesnt work:
$forms = $this->getForms();
$form = Arr::first($forms);
$sqlComponent = $form->getComponents()[0];
$textArea = $sqlComponent->getChildComponents()[1];
$translatedSql = "translated";
$textArea->value($translatedSql);
36 Replies
ahm, just update the value of the variable
$this->textAreaNamedVariable=xy;
Aka $this->description='description'
anyhow have a full code?
what are you trying to achive?
pressing a button and just kinda filling in the textarea with that
do you have an image of the "form"?
gotcha
Press Translate to SQL button and i wanna fill the SQL text area
it's a static form?
because in that case just create a variable
kinda ye
in the specific Resource.php
and in the function
sec, let me put a code together
thanks man
and add to the textform
do you have the mount function ?
like where ?
i made the changes and get no errors but it doesnt update the value somehow, so i cant see text in the textarea
send me the code of the form
text area
do you have installed debugbar?
xdebug
imma go and debug a bit š
GitHub
GitHub - barryvdh/laravel-debugbar: Debugbar for Laravel (Integrate...
Debugbar for Laravel (Integrates PHP Debug Bar). Contribute to barryvdh/laravel-debugbar development by creating an account on GitHub.
and add like that the reactive to your textarea
made it? š
still trying hehe
should be working the one I sent
and if you install the debugbar
you can see the livewire properties from the browser
You probably need to set
$this->data['sql_text']
instead of the propertyomg this works lol
but then u are using $data
to store all the values
also added reactive() like u said
It's inside the admin panel I guess.
and not hard-coded variables
Admin panel pages always use
$data
ah well
my bad with that
yes im in the admin panel, should have made that clear i guess
But close enough š
I'm mostly using outside
š
thanks for all your help guys
You could have selected the "admin panel" tag for the question š
and using $data in case I have a dynamic form š
welcome š