submit form and keeping values setting - forms

I want to know if there is a way to submit a form but at the same time keep the values selected and edited(without reset).
Thanks.

One is to use ajax.

Your question is very vague... You will likely need to use PHP (cookies) to store the entries / changes.

In ASP.Net MVC, you may set the page with the form to submit to inherit an instance of a class which properties are set automatically.
In order to keep the values after the submit, you just have to place the object model as the same object that you received as an argument in the action, like this return View("ViewName", object).
But anyway, your question could have been a little more specific. Hope that if you are using .Net, this may be useful.

Related

how to mark/check a checkbox in Moodle

I have a lot of checkboxes and their names are generated with the help of the resource id they are associated with, which in turn is fetched from the database.
$mform->addElement('checkbox', 'incres'.$coursename.$sec->section.$record3->instance);
The second parameter is the name of the checkbox.
I need to know how to mark this checkbox as checked.I have a feeling this can be done by the setDefault method but I cant figure out how. I tried
$mform->setDefault('reqdres'.$coursename.$sec->section.$record3->instance,1);
But that doesnt work. I dont wish to use Javascript or the advancecheckbox element for this since that will require me doing a lot of changes in other dependant modules
Did you try using the Advanced Check Box? $mform->setDefault() should work with this.

Prefilled notes of Class attributes in Enterprise architect

is there a way to have prefilled attributes notes in enterprise architect?
It should be something like this scenario:
1) I create new attribute
2) Enterprise architect prefill note of attribute with predefined text
Something like template for attributes.
Thank you for any advice
I know this won't help directly this question.
Anyways you can achieve it through an external addin.
All you need to do is handle the EA_OnPreNewAttribute and EA_OnPostNewAttribute broadcast events .
This isn't quite what you're after but it is possible to create an Attribute stereotype in a Profile and add to this a Tag with an initial value set to what ever you want. When you create an attribute with this stereotype, this means your predefined text would appear in a tag-value for the attribute rather than the note. Not ideal, but might work for you.
You could also have a go at writing some JavaScript to do this as well (under Scripting in EA). You'd have to use the JS to navigate the repository structure, find the attributes in question, and update their note. I don't believe you can attach a script to a UI event, so I think you'd be stuck running this post-hoc rather than having the note auto-populate on attribute creation.

How to check when a form was rendered in Laravel

Upon a form a submission, I wish to determine the time that a Laravel form (built using the Laravel Collective HTML package) was rendered to the user.
I need to check this date upon submission for a variety of reasons.
I have a large existing project and am considering the best way to get this date. I was reading the CSRF middleware (since this token is already included in all forms) to see if it can be extracted from that, perhaps in another middleware adding something like form_generated_date to the request.
It looks like a bit of a stretch, if possible at all. So now I am looking at adding a custom field to every form.
I would like this to be included in all forms, just as the Form::open() method will add the CSRF token. I found information on adding my own macros, but not about extending this method.
Does anyone know if it's possible to get the date from a CSRF token? Or how (or where the documentation is) to extend the Form::open() method.
The Form::open() method looks to be in the FormBuilder.php file (https://github.com/LaravelCollective/html/blob/2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6/src/FormBuilder.php).
This file can be found in /vendor/laravelcollective/html/src/FormBuilder.php
You should be able to add a new hidden form field to the open method, bearing in mind that this will be overwritten in any updates. Not really recommended, but will achieve what you are looking for.

SYMFONY FORM - filter attribute form on top with submit button, that provides a table with other form used to edit each row details

I am looking for best practices on SYMFONY FORM handling to achieve the following standard page (surprisingly I haven't found anything similar existing yet on SO).
Here is a shema of what I want to achieve:
As you can see at the top there is a SYMFONY FORM to filter the results that should be displayed.
It displays a table and each tuple of the table should permit to open another SYMFONY FORM kind linked to the tuple.
I am in the process of learning SYMFONY FORM, so far, I can manage to create the top row FORM to set the filter that'll apply to the table display.
But I wonder if anyone has experience on the second part: Displaying the table that embed as well many forms of a similar kind -That seems a bit more complex. I read about TWIG.EXTENSION and FORM.COLLECTION, I'll investigate that. But if someone could save me to re-invent the wheel and lead me to some direct shortcut, I'd be really grateful.
No idea if it's the best practice, but one way to do it would be to create a new property for your entity being listed in this table, called $editionForm (without mapping it to the database) for example.
Then, either throught a custom loop or by listening to a doctrine (or any ORM you use) hydration event (or triggering such an event if you don't use any ORM), fill the property with the generated form, probably within a dedicated service.
Then, just use it in your template like this :
$entity->getEditionForm()->render()

How can I display another form in a z3c.form button handler?

I have a form with a single text field.
On submit I would like to display another form.
I can use RESPONSE.redirect() and pass it in the query string but I would rather not.
I don't want to use a SESSION variable.
I would like to display a second form which can read this value from the request variable.
I have looked at collective.z3cform.wizard but it is not obvious how to do this.
Trying to call the view() from the button handler does not seem to have any effect.
I fall in the same lack of functionality.
For what I know, z3c.form does not support this kind of traversing.
You may remember that this functionality worked well with CMFFormController.
Actually to do this, cmfformcontroller used session machinery.
So, you don't want to use session but that's the way. At least I do so, and I'm happy.
In this way there's no need of a wrapping tool like z3c.form.wizard.
hth,
alessandro.
collective.singing has a non-session based wizard which uses hidden fields to store results of intermediate steps.