Refresh button without prompt on symfony - symfony

I need make a button for refresh a page withe the same values POST in bafore form.
The flow work is: Form1(values) > show | show > refresh button (with the same values ion From1)
I try with javascript but allways get Prompt (resend data?). So, I make a other form(Form2) for the refresh with all fields hidden and i want put all values on Form1 in the Form2 fields.
Thanks !

Finally I found a solution... but is not simple.
Frist, we need the 2 forms, the form for introduce the data, and the form with the same fields but hidden.
So, we need pass the data from the first form in return of the action in controller, and then, in the view reassign this data to hidden fields from from 2.
I use Twig for this.
I hope that it's usefull for other persons whit the same problem.

Related

Orbeon Forms - Buttons and Labels

I need to add the send button twice to my form build using Orbeon Form builder; the first one should display 'Submit' and the other one should display 'Print and Submit'. But I see that the first label is getting replaced by the last one. Can some one please tell me how to add two different labels for the same button when when adding it twice to the form. This for a requirement where the form need to have two buttons. First one should submit the form to a rest service( I am using send button for this) and the second one should print and submit the form to rest service. Please help.Thank you.
As you have found out, you cannot put the same button twice. They have to be different buttons, which means that they have a different name. If a button is called send then the other one must have another name like send-and-print.
So create one button called send, the other one must be called something else. So you simply create a new button following Button and processes.
The open-rendered-format action is new in Orbeon Forms 2017.1. You don't say which version you are using though.
I would also properly format the process so that you can easily take out and add parts, and see which part(s) fail:
<property as="xs:string" name="oxf.fr.detail.process.send-and-print.*.*">
require-uploads
then require-valid
then save
then open-rendered-format(format = "pdf")
then save-final
then send(uri="http://192.168.25.18:8080/RestService/rest/xml", content="xml", replace="instance") then
navigate("http://192.168.25.18:8080/email-sent-virgin-ausi.h‌​tml")
recover navigate("http://192.168.25.18:8080/email-fail-virgin-ausi.h‌​tml")
</property>

Google Appmaker: Update form based on selected dropdown option

I have an AppMaker app that has a from based off of one address table/datasource. I can get a form with next/prev buttons, but replaced the key field (name) with a dropdown list of all names (a user can start typing names to jump there, with the dropdown showing).
My hope is that when a user selects from the dropdown, the entire form updates and the next/prev buttons work properly as well (there too many records to page thru with next/prev only). I don't have to have next/prev functionality if it complicates things too much.
Currently the dropdown is working, but I cannot get the index for the next/prev buttons set or the rest of the form to reflect the selected dropdown record.
I've tried to set the "onValueEdit" event to something like this...
var selected = widget.value;
var idx = widget.options.indexOf(selected);
console.log("Selected: "+selected+", index = "+idx+"\n");
if(idx < 0) { //...this error is never hit
console.log("Index error - setting to zero!\n");
idx = 0;
}
widget.datasource.loadPage(idx); //...update form?
Two observations via console logging:
The "idx" var is never set to the selected dropdown index reliably, and is
often "0" (tho no error msg ever shows), so the "indexOf()" function
isn't working as expected.
The "selected" var (name) is always correct.
If I call widget.datasource.loadPage(...) with a fixed value (say 5) it has no effect on what is shows in the form either (previous loaded data remains) - obviously not the way to do it :v/
Can you steer a noob in the right direction?
If you are using default App Maker form, then you can see that so-called pager, doesn't actually paginate. It triggers prevItem/nextItem datasource methods, in other words it navigates through datasource items, not pages. Here is a quote from App Maker docs:
nextItem: Selects the next item. For Query Datasources, if the current item is the last item on the page, then this loads the next page and selects the first item on the newly loaded page.
So, if you already have all your items loaded(you set query page size for your datasource to 0), then you need just to change selected item within datasource:
// onValueEdit dropdown event
// assuming, that form and dropdown share same datasource
widget.datasource.selectKey(newValue._key);
If you really have lots of items and it is not feasible to load all of them in one call... then it will be all another story...
UPDATE:
It's important that Options and Value are set as shown in the image below!
However, I had trouble setting them that way (read: wasted hours!) until I wiped them both completely using More options in the binding picklist, and tried again (I had even tried on a brand new app!). I was being forced to choose ..projections.. and then a final field before the OK button would be available.
Not sure if AppMaker is buggy here or there is something simple I'm not understanding!
None of the coding in my original question is required.
Once set this way, binding just works as you would expect it!!
All other fields are set as #datasource.item. and are bound to whatever item is chosen. No Events settings are necessary for the dropdown either, as I thought they might be.
I deleted this page and started again, and replaced the default business name data field with a drop down, I set the dropdown as:
Options: #datasources.Addresses.items
Value: #datasources.Addresses.item
It works fine?! Not sure what happend in my original page!
UPDATE:
So it seems you need to delete both the Value and Options and then re-enter these. The OK will light up when you do.
Also, my original take on App Maker was to build the UI and attach data. That was my first mistake. You build the data then have App Maker build edit/add pages for you.

What exactly is the difference between {$taxonomy}_add_form_fields and {$taxonomy}_add_form

I'm observing very similar behavior for both {$taxonomy}_add_form_fields and {$taxonomy}_add_form is there a diference and what it is? I understand the semantic difference of form and form field, but I'm wondering how WP sees it.
There is no record of it in the Wordpress Codex and Developer part of the Wordpress website is giving almost same description.
See for yourself:
https://developer.wordpress.org/reference/hooks/taxonomy_add_form_fields/
https://developer.wordpress.org/reference/hooks/taxonomy_add_form/
Taking a look into /wp-admin/edit-tags.php, we can see the do_action( "{$taxonomy}_add_form", $taxonomy ); is used to replace to preceding deprecated filters. That's why it was added.
Getting to the "difference" between them, you could see in the code that the filter {$taxonomy}_add_form_fields is used to add data to the form just before the submit button has been created, while the other filter {$taxonomy}_add_form is used after the submit button (but still before the closing tag </form>.
Usually, you could think about putting visible fields before the submit button and then adding hidden fields right after it. But it's not a sort of great difference between them.
Both of actions is in the form tag.
But, {$taxonomy}_add_form_fields action is before submit button and "{$taxonomy}_add_form" action is after submit button and add_tag_form action.

ASP.Net Code Optimization

I have almost every piece of code, I just need it to be optimized using correct IF_ELSE conditions and arranging the right flow.
I have a webform (UserProfile.aspx), which contains FormView (to display user profile).
In FormView ItemTemplate, I have put simple HTML and ASP.Net Labels to display Info using Label's Text property :
Eval("col_name");
In EditItemTemplate, I have same table with but textboxes instead of Labels.
I have a button "Edit", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.Edit); [ WORKING ]
I have another button "Cancel", on its Click event, I'm changing FormViewMode
FormView1.changeMode(FormViewMode.ReadOnly); [ <-- NOT WORKING ]
To display user profile, I'm passing user-id from querystring (querystring field = "user")
So the valid URL looks like :
/UserProfile.aspx?user=121
What I want to achieve is :
If (user_IS_Logged_In)
//Some basic tasks like setting welcome message label with username/email etc.
If (querystring_is_EMPTY OR querystring_field_is_incorrect OR user_IS_NOT_Logged_IN)
//Remove the Edit and Cancel buttons
If (querystring_field_is_exist)
//initialize user_id (this will be passed to ShowUserDetails(user_id))
If (user_IS_Logged_In AND querystring_is_exist)
If querystring value and logged in user_id ARE NOT EQUAL THEN
//Again Remove the Edit and Cancel buttons
P.S --> I'm thinking to add an UpdatePanel around the FormView Once I achieve above tasks, for consistent look.
I know the problem is quite difficult to understand so feel free to ask details.
I will provide the code as needed.

SharePoint list item with checkbox databinding possible?

In SharePoint I can tee up a binding to an edit field like this below. When the form posts back the changes are automatically persisted to the underlying list item.
<PublishingWebControls:RichHtmlField ID="Field1" FieldName="MySPListItemFieldName" ...
So this works great for RichHtmlFields, but say I've got a Yes/No (boolean) field in the same list item, is there a similar construct to bind that field to a check box control in a similar way?
My goal is to not have to throw down a line of c# to transfer the value of the control to the field, I want it to be automatic like RichHtmlField. It seems like there has to be a straight forward way of doing this since SharePoint does this itself with its internal list item editing page (EditForm.aspx).
What you're after is a BooleanField control on your form:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.booleanfield.aspx
Just set the FieldName to that of your Yes/No column, should work fine.

Resources