Redirect to /create button link - laravel-backpack

I want to create a button in list view that if the user click, it is redirected to the create form with the data completed with the attributes of the clicked entity.
Screenshot 1:
And it is redirected to te /create form with the data completed in the fields
Screenshot 2:
Then the user can modify the data and save it.
Ive tried put /create?default=123
CRUD::field('estado')->type('text')->default(request('default') ?? null);
And it works. But what about select2_from_ajax_field?? It seems that the default value is not working.
There is a way to acheve this?
Thanks

Related

Ionic 1, how to reload a part of page, not the whole page

I'm working in app using ionic 1, It's a social network app.
My problem is that I want to reload a value, not the whole page and I don't know how to do it.
This my example from my news feed:
I want when I click like or comment the new value appear without reload all page.
For now I use:
$window.location.reload(true)
PS:
When a user click in like, a new like add in database and the number of likes add +1, so when I reload page the new number of likes appear.
So again the problem is how to reload a part of page, not the whole page.
Thanks in advance
Ragnar, try to bind the like value in a $scope variable and then when the process to add the like in database is complete (process.then()..., for example) update the $scope variable.
If you are using an array to fill this, get the $index (generated by ng-repeat) and update only the $scope variable for the related item

in YII2 how to post data using modal dialog?

I'm using modal dialog. I'm working with two modal. User Model and STATE Model where
User is Parent model and state/create is open in modal dialog.
when I'm creating new User, I have select state name from drop-down, if it is not listed in dd then it will create state by clicking add new state and open in modal dialog and create state.
Issue is after create new state parent page is refresh and all the data which I have added are removed.
Kindly guide me. I have created modal dialog by below link
Not sure if I understand your problem correctly because there is no example code. But if you have separate form to add new state then you can submit that form with ajax using beforeSubmitevent of ActiveForm.
An example of beforeSubmitevent implementation you can find in this issue
Also in your controller action you will have to set response type to json like following
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
More info on response types.

How can I show a "please wait" message while submitting (logging in)

I use an to show a message while running some code via a JsonRpcService. Works like a charm.
Now, I would like show a similar message saying "Please wait..." when the user submits a page. In this particular case it is logging in - where I need to read a lot of data to show the user. I submit the login info in a custom control when the user presses the icon (=button):
<xp:image url="/arrowGrey.png" id="submitButton" styleClass="submitButton" alt="Login" title="Login">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:Logon.submit()}]]></xp:this.action>
<xp:this.onStart><![CDATA[console.log('Start login');
setTimeout(function () {
XSP.openDialog('#{id:working}');
}, 300);]]></xp:this.onStart>
</xp:eventHandler>
</xp:image>
Logon is a managed bean. However, I never see the dialog box... - nor the "Start login" message?
The definition of the is:
<xe:dialog id="working" styleClass="inProgress">
<xp:div>
<xp:text escape="true" id="computedField1" tagName="h2" value="Logging in. Please wait..."></xp:text>
</xp:div>
</xe:dialog>
Any ideas as to how to obtain this?
The obvious next challenge is to close the dialog should the Logon.submit() fail validation and keep the user on the current page... :-)
If you are doing a Full refresh then the standby widget will not work. it only works on partial refreshes because a full refresh will reload everything on the page. But the standby widget is using a standard Dojo function that you could use.
Or what I usually do when I have some of code that needs to be executed. I send the users to a "please wait XPage" with an animated gif.
The trick is that the code can't start executing before the page and the gif is loaded so I add the code to a hidden button and in the onload event I click this button using client side JS that executed the backend code.
And when I'm done processing, I send them to the right page using context.reloadPage
This works very well.
Fredrik Norling created the very cool "Standby Custom Control" (http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control). It doesn't show a message but a spinning wait icon on every partial refresh that might endure longer as 200ms (you can tweak this down or up if you want to).

setting menu item property from another form in oracle

good day, i am working on a system using Oracle Forms Builder. i have 3 forms, MAIN, LOGIN, and REGISTER and a menu form named MENU_MAIN, it is attached to the 3 forms, the first form that will be shown is the MAIN, i made some buttons disabled because the user cant access unless they are registered and login, now my problem is, after they login they are prompted again to the MAIN and i need the button that is disabled to be enabled, how can i do that? am i gonna put the code on the LOGIN? thanks for the response
"am i gonna put the code on the LOGIN?"
Well I honestly don't know which other part of your application can know that a user has logged in, so yes, the LOGIN screen has to handle this.
What should it do? It should set a value in a global variable. Your MAIN screen should interrogate the global variable, probably in a When-New-Form-Instance trigger, and set the buttons' properties accordingly.

Clicking a button with an id but no name with Perl Mechanize

I am trying to click a button with Perl Mechanize, but there are some twists because I am trying to apply the same script to different sites, each of which has the same id attribute for the button, but the forms are not the same number on the page, and the buttons have no name, just an id.
Is there any way to click a button when you only know the id?
Failing that, what is the best way to determine the number of the form that holds a button with a given id?
See HTML::Form:
for my $form ($mech->forms) {
if $form->find_input('#theid') {
# this is the one
}
}