sending values to form made at Form Builder in edit() function

Laraship QuestionsCategory: Technicalsending values to form made at Form Builder in edit() function
nao asked 6 years ago
At edit() function of UsersController class, values are given into create_edit.blade.php below process: view('User::users.create_edit')->with(compact('user')); Then values are shown at each form items. This case can achive because form items are coded directly in create_edit.blade.php file. I have a question. If I embed form made at Form Builder in create_edit.blade.php file, can values be given into embed form? If no, how do I code to archive?
laraship Staff replied 6 years ago

can you give us an example on what values you want to pass

nao replied 6 years ago

As a result, the values whici I want to pass into embed form are various.
If field type of form item and column of table are ‘string’ type, it can pass as it is.

If password, value of password must pass as vacant.

If column of table is ‘date’ type, but form item has two ‘string’ type.
Because year and month have to input directly in text field.
So before passing, the value of ‘date’ type column have to divide into year and month values.

laraship Staff replied 6 years ago

You can pass parameters if you are using the external embed code, not the shortcode

nao replied 6 years ago

I see.
Than you for replying.

2 Answers
laraship Staff answered 6 years ago

Hello,

You can pass parameters if you are using the external embed code, not the shortcode

nao replied 6 years ago

According to your reply, this is my sample code.

ClassController extends BaseController:
public function edit(BookRequest $request, Book $book)
{
$data = array(
‘foo1’ => ‘bar1’,
‘foo2’ => ‘bar2’,
:
:
);

return view(‘BookFolder::book.create_edit’)->with($data));
}

create_edit.blade.php:
@section(‘content’)

@component(‘components.box’)

@endcomponent

@endsection

Before passing data to create_edit.blade.php, I need to set $data array.
Can $data pass to external embed code?
If no, how do I modify source?

nao replied 6 years ago

Oh, external embed seems not to show.
@component(‘components.box’)

@endcomponent

is source.
String “https://domain” intentionally omitted.

nao replied 6 years ago

I’m sorry. external embed code can’t show.

My sample code of create_edit.blade.php, inside of
@component(‘components.box’)
@endcomponent
has external embed code.

laraship Staff answered 6 years ago

It will be something like this

<div data-embed-src="http://formbuilder.laraship.com/forms/v1oz1Yz27j/embed?**data1=val1&data2=val2**"><script type="text/javascript" src="http://formbuilder.laraship.com/assets/corals/plugins/formbuilder/js/embed.js">

where data1 and data2 are field names

nao replied 6 years ago

Thank you for replying.
I’ll try to code this way.

nao replied 6 years ago

You reply to me “embed?**data1=val1&data2=val2**”
Is “**” string required for query parameter?

nao replied 6 years ago

“**” is to emphasis about query string.

I have a question.
When item of embed form is checkbox, how do I pass values?
And checked values of checkbox is multiple, how do I pass?

laraship Staff replied 6 years ago

checkbox and multiple checkbox not handled yet

nao replied 6 years ago

Ok.
When will your company develop about checkbox and multiple checkbox?

laraship Staff replied 6 years ago

please stay tuned or futured updates

nao replied 6 years ago

OK.
This time, I’ll develop by myself.

Thank you for replying

nao replied 6 years ago

When the parameter value passed to input type of radio of embed form, all values of radio are overridden by passed value.
To make sure, When I don’t pass parameter value to input type of radio of embed form, all values of radio are fine(not overridden).
I wonder this is bug…?

laraship Staff replied 6 years ago

As previously mentioned this feature is supported for Text / Text Area / Select fields

nao replied 6 years ago

input type of radio isn’t supported now.
OK. Thank you.
Please close this topic.