open-admin icon indicating copy to clipboard operation
open-admin copied to clipboard

input data using $form->html()

Open uluumbch opened this issue 1 year ago • 3 comments

Help Me I want to create input using HTML $form->html() but when submitted the data is not save to database

Is anyone can try to make it work? System

  • Open-admin version 1.0.27
  • PHP version 8.3
  • Laravel Version 10
  • OS: [e.g. Linux / Win / Mac] Windows 10
  • Browser [e.g. chrome, safari] Chrom

uluumbch avatar Mar 27 '24 06:03 uluumbch

Hi, $form->html("input name='your_html_input'>"); //Or put your html into a view and view('your-view')->render();

//Register column with form $form->hidden('your_db_column');

$form->saving(function($form){ $form->your_db_column = $form->input("your_html_input") });

just dd($form) in the saving hook and check the inputs

RCyrix avatar Apr 09 '24 17:04 RCyrix

Hi there, just an update, i had to do something similar to this, i found that HTML tags are ignored, i have not yet figured out why, though select tags for example are referencable in the manner described above,

With the text what i ended up doing is writing a lil script, that on keydown it updates a hidden field, ( $form->hidden('your_db_column'); )

The value is then available in saving hook

Not sure why it does not work with text type inputs, so anything that uses text as a base, time, calendar, text, email, but it picks up on

RCyrix avatar Apr 12 '24 21:04 RCyrix

Hi there, just an update, i had to do something similar to this, i found that HTML tags are ignored, i have not yet figured out why, though select tags for example are referencable in the manner described above,

With the text what i ended up doing is writing a lil script, that on keydown it updates a hidden field, ( $form->hidden('your_db_column'); )

The value is then available in saving hook

Not sure why it does not work with text type inputs, so anything that uses text as a base, time, calendar, text, email, but it picks up on

well, that makes sense for me to create additional script for that, maybe this can be my temporary solution for now thank you!

uluumbch avatar Apr 13 '24 02:04 uluumbch