Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 25 21:30
    ibelar synchronize #1544
  • Nov 25 21:30

    ibelar on add-lookup-to-other-vue-form-control

    remove test comment (compare)

  • Nov 25 21:27
    ibelar converted_to_draft #1544
  • Nov 25 21:26
    ibelar opened #1544
  • Nov 25 21:24

    ibelar on add-lookup-to-other-vue-form-control

    init Merge branch 'develop' into fea… improvement (compare)

  • Nov 25 19:52
    mvorisek commented #1539
  • Nov 25 19:51
    mvorisek assigned #1539
  • Nov 25 19:51
    mvorisek commented #1539
  • Nov 25 19:50
    mvorisek commented #1541
  • Nov 25 19:47
    mvorisek assigned #1540
  • Nov 25 19:47
    mvorisek commented #1540
  • Nov 25 18:18
    bedengler commented #1540
  • Nov 25 18:16
    bedengler commented #1540
  • Nov 25 16:08
    bedengler commented #1540
  • Nov 25 14:10
    georgehristov review_requested #1543
  • Nov 25 14:10
    georgehristov review_requested #1543
  • Nov 25 14:10
    georgehristov opened #1543
  • Nov 25 14:10

    georgehristov on wizard-form-no-save-button

    [fix] check if buttonSave set (compare)

  • Nov 24 20:35

    DarkSide666 on multiline-with-contains-many

    (compare)

  • Nov 24 20:35

    DarkSide666 on develop

    fix/ Multiline using containsMa… (compare)

KyleBroflovski925
@KyleBroflovski925

Hi guys, I have a question about custom validation. I have a field that has a parameter required in the model :

$this->addField('field', ['required' => true]);

And when I click save and this field is empty. I get a error message "Must not be null".
But if I want to get another text in this message, how can i do that ?

I tried to do it like this :

$form->onSubmit(function ($f){
if (empty($form->model['field'])) {
return $form->error('field', 'My error message');
}
});

But this does not work because the field has a parameter 'required' => true in the model and shows the default text “Must not be null”.

Thomas Stokkeland
@stokkeland
good question
Thomas Stokkeland
@stokkeland
for whatever &*^%&^$ reason discord is not very good at customer service - someone has signed up with my email, and they arent letting me reset and recover.. i'll sign up on some other alias some day but for now i am here. Ui 1.7 - i found that if you add a popup to a button within a form, then add a form to the popup, submitting the popup form submits the mother form, which is rather annoying.. i am solving it by not using submit, having a regular button and grabbing values with js instead.. i am to far along to make any changes or have time to study and submit bugs (or change to 2.0) .. just curious to if anyone has seen this behavior? (in a modal the subform works fine, in a popup it affects the mother)
PhilippGrashoff
@PhilippGrashoff
Hi Thomas, can you check the resultign HTML code? Maybe there is a <form> inside a <form>. HTML forbids that, and if so that could very well cause your problems
Modal is directly attached to the <body>, but popup I dont know. For positioning it sensibly it would make sense to have the code next to the triggering element, and that would cause the nested forms
What I meant for Modal is: As Modal code is attached to <body>, it does not cause nested forms
Romans Malinovskis
@romaninsh
‘Required’=>’custom text’
Instead of true.
If not swap from required to mandatory and do your own validation.
Required - UI level. Mandatory - model level.
Thomas Stokkeland
@stokkeland
That you @PhilippGrashoff - that makes sense, i did not test it yet, but if the pupup is attached to a button within the other form.. i will check that out,
Romans Malinovskis
@romaninsh
@domainoverflow haha that’s great to know!
Alex Cicovic
@acicovic
Hello everyone, can anybody send me a discord invite? Thanks! :)
Georgi Hristov
@georgehristov
Alex Cicovic
@acicovic
@georgehristov thanks!
Thomas Stokkeland
@stokkeland
ui 1.7 - Grid with addSelection. Added button in grid menu, and in $btn->on('click') I can return $selection->jsChecked() or take it as a parameter .. but i am failing to figure a way to get that selection value to a modal as a result of that button click. I tried to figure out how UI does it with addModalAction, but i was unable to follow.. I guess what I need is "AddModalBulkAction" of sorts and get selections into my dynamic modal...
Svetlozar Kondakov
@skondakov
Hello - did you try to reload the modal content with passing a parameter - the result of the $selection->jsChecked()
Thomas Stokkeland
@stokkeland
@skondakov I am not familiar with how to pass or reload parameters to a modal? in a regular on-click i know I can do that with $btn->on('click',function($jq, $param) {} , $sel->jsChecked()); but i don't know how to make the same for a modal.. right now is create the modal, then use $modal->set( function($m) { } ); any chance you could explain the reload with parameter please?
would be nice if it was $modal->show( $sel->jsChecked() ) but i dont think it is that simple
Svetlozar Kondakov
@skondakov
@stokkeland sure, .. not sure it will work in your case though. So here goes ... most of the UI elements in AgileUI can be hot reloaded .. and during a reload you can pass GET parameters. The reloading is done with this code
new \atk4\ui\jsReload( $ui_element, [ 'selected_items' => $sel->jsChecked() ] )
you can place a simple View element in the modal - get it in a variable and then try to reload it with this code
and then debug and see what you have in GET
Thomas Stokkeland
@stokkeland
hmm.. okay reload an element in the modal on that click? yeah that might work
Thomas Stokkeland
@stokkeland
i couldn't figure out a way to make that work.. not really a UI and JS guy, so not exactly following all the magic concepts of js/jq here. Consier this block:
$myview = $app->add(['View']);
$grid = $myview->add(['Grid']);
$grid->setModel($model);
$grid_selection = $grid->addSelection();
$bulk_button = $grid->menu->addItem('Bulk Operation');

$modal = $myview->add(['Modal','title'=>'Bulk it baby']);

$modal->set(
   function ($m)
   {
       $form = $m->add(['Form']);
       $form->addField('selection_data');
   }
);

$bulk_button->on('click',
   function ($j, $param) use ($modal)
   {
      // $param does right here contain the selection values
      // how do i get it to my modal, e.g. into the selection_data field   
      return [
         $modal->show()         
      ];
   }
   ,[$grid_selection->jsChecked()]
);
Thomas Stokkeland
@stokkeland
i trieda adding a $f = $form->getField('selection_data'); then in the on click return add $f->jsInput()->val($param) but doesnt work since the form havent been created yet
Thomas Stokkeland
@stokkeland
this one works with a static modal - but i don't really want the static modal..
$myview = $app->add(['View']);
$grid = $myview->add(['Grid']);
$grid->setModel($model);
$grid_selection = $grid->addSelection();
$bulk_button = $grid->menu->addItem('Bulk Operation');

$modal = $myview->add(['Modal','title'=>'Bulk it baby']);
$form = $modal->add(['Form']);
$form->addField('selection_data');
$sel = $form->getField('selection_data');

$bulk_button->on('click',
   function ($j, $param) use ($modal,$sel,$form)
   {

      // this form manipulation does not work on a click event
      $form->addField('Test',['required'=>true]);

      // this return works and $param is set, but is not ideal, sine the modal is now quite static   
      return [
         $sel->jsInput()->val($param),
         $modal->show()
      ];
   }
   ,[$grid_selection->jsChecked()]
);
Svetlozar Kondakov
@skondakov
Ahhh I'm afraid the proposed solution is for static modal only
you can't really use it for dynamic modals
I guess someone else should be able to help with this, but there should be a way to pass params to a dynamic modal when loading
I would suggest adding a thread in the ATK forum
Thomas Stokkeland
@stokkeland
okay thank you.. yeah the framework itself does it within grid with "addModalAction" in a row - i am just not able to follow exactly where/how it does it.. I will try the forum. For right now my very dirty workaround is using $_SESSION with a short timeout
FabulousGee
@FabulousGee

Hey guys. Can someone point me at the right direction regarding a problem in my model please? I have got a hasOne relation and want to use it with a given condition.
Like having Model1 and Model2, Model1 hasOne Model2 and when I load Model1 I only want to have Model2's loaded that match a given condition (e.g. ownStuff == true)

I tried several methods already and searched around the forums but either it's a dumb question or nobody else has this issue^^ this is the current code:

$this->hasOne('Resource', [ResourceModel::class, 'their_field'=>'id', 'our_field'=>'Resource_id', 'caption' => 'Ressource']]);
$this->ref('Resource')->addCondition('ownResource', true);

btw. it works fine when I add the condition directly into Model2/ResourceModel - but I want it to work from Model1 :(

PhilippGrashoff
@PhilippGrashoff
Hi, though I do not really understand your use case, if you want to add extra conditions to a reference model, do it like this:
            $this->hasMany('Notification', [
                function() {
                    return (new Notification($this->persistence))->addCondition('model_class', get_class($this));
                },
                'their_field' => 'model_id']);
like this you can add conditions to the reference model
mkrecek234
@mkrecek234
Hi everyone, I have issues to get a) the ui ribbon label decorator working in a grid. With the standard hook getHTMLtags HTML looks right but the left part of the ribbon is missing. b) I can't get date format changed to German style 01.03.2020 - the $config['locale']['date'] does not have any effect on my grid. Can't find anything else on the net. Any help?
mkrecek234
@mkrecek234
BTW - same issue that the dropdown icons for a filtered grid are not visible - using the most recent Agile UI 2.0.4
PhilippGrashoff
@PhilippGrashoff
Hi, to switch to a german date format you have to set it in atk4\ui\Persistence\UI
An instance of that object is always in App. the property name is persistence_ui
so you can set it like $app->persistence_ui->date_format = 'd.m.Y';
mkrecek234
@mkrecek234
Thanks a lot - $app->ui_persistence->date_format worked 👍
Any idea on the UI issues above? Seems to be a CSS issue as the left ribbon part going around the grid is missing - and also the dropdown arrows in the grid header row are not shown (but working)
Svetlozar Kondakov
@skondakov

Hi everyone, I have issues to get a) the ui ribbon label decorator working in a grid. With the standard hook getHTMLtags HTML looks right but the left part of the ribbon is missing. b) I can't get date format changed to German style 01.03.2020 - the $config['locale']['date'] does not have any effect on my grid. Can't find anything else on the net. Any help?

Hello, did you try $this->app->ui_persistence->datetime_format

ahh sorry
this seems answered already
mkrecek234
@mkrecek234
Does anyone have a hint for me why the atk4/ui-develop demo shows nice € amounts, and my version with 'Money' field type does not show € signs? I could not find any trace where to configure that :-(
PhilippGrashoff
@PhilippGrashoff
its also in Persistence/UI IIRC
Svetlozar Kondakov
@skondakov
@mkrecek234 did you try $this->app->ui_persistence->currency
?
Thomas Stokkeland
@stokkeland
i always set $this->ui_persistence->currency = '$';