alter edit/create node form that pop ups in overlay - forms

After digging a few months now in Drupal 7 and learned the basic concepts of the architecture i am stuck on something that looks pretty straight forward... .
I know how to alter forms that are in the website (such as the search form or the login form)... but i can't get it work to alter the node edit/create form (the one that shows up in the "overlay"... with the (custom)fields.
What i want to achieve is to change the default value of a select field when the form pops up in the overlay.
I tried the _form_alter(...) en also the admin theme seven_form_alter(...) hook but nothing gave the opportunity to alter the node edit/create form... .
Can someone give me the right push to get back on track?
Google didn't help me further on this one and am getting a little bit depressed... .
Links like these, i hoped helped but they didn't:
drupal alter node edit form
thx

Hi The form alter should work irrespective of what the form is in Drupal. It will work for each and every form in Drupal provided you have give a proper condition to check the form id first.
One more suggestion. when you are trying form operations in Drupal disable the overlay module temporarily & then work on it..

Related

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()

Simulate Form Submit with Symfony 2

I'm working with Symfony 2 and need some advice.
I have a Controller, which gets a form-request and searches the database for matches and renders the results (so it's just a basic search).
Now I would like to redirect to this controller but without coming from a form.
To be more specific:
I'm on the search-page, fill out the form and hit the search button -> I get results for my search.
I'm somewhere else and want to delete a labelCategory of a book -> If some books still use this labelCategory, I want to get search results for this labelCategory.
My only idea so far is, to simulate the form submit somehow, but I didn't find out how to do it.
I'd be happy for every help of you ;)
You don't need form submit at all. Just put logic of searching to separate class. Than you can it in any controller you want. Maybe Service Container doc can help to

Twitter/Facebook-like User Tagging In A Rich Textbox/TinyMCE

I'm looking for a little advice as to how to go about this one.
I've got an ASP.NET MVC 3 application written in C# with a form that contains a TinyMCE textbox as its rich text editor.
I've been asked to see if it is possible to add user tagging into the form via the textbox much like Facebook/Twitter with #user and an autocomplete.
I've got a reasonable idea of how I'm going to go about getting the data, but I'm not certain if it's even possible to add the functionality to TinyMCE (if that's where it needs adding).
In short, I'm just after a way of a user being able to start typing #user and have the autocomplete dropdown come up much like on Facebook. Though the piece of the puzzle I'm missing is how to implement it. I've got a rough idea of how it will be pieced together overall, just not how to get it to work within the TinyMCE box or have it start working when # is typed (when not part of an e-mail address too).
Any suggestions?
Twitter has made available their own auto-linking engine, take a look: https://github.com/twitter/twitter-text-js
It is as simple as
// basic extraction
var usernames = twttr.txt.extract_mentioned_screen_names("Mentioning #twitter and #jack")
// usernames == ["twitter", "jack"]

ACCESS 2010 Navigation Form Query Property

I'm coming accross a problem and i have searched the entire World Wide Web:
I have a Navigation form which has forms in it.
Those forms are used to give properties to my queries.
For example:
FormStatus-->Ask user to select the status and shoot the value to the query.
These queries build reports.
The main problem is that now that my form is in a navigation form, the link for the property is no longer working.
The link used to be : Forms!myForm!myProperty
Now i tried
Forms!navigationForm!myForm!myProperty
Me!myForm!myProperty
Forms!ParentForm!SubForm.Form!FieldName
Nothing works out!! Can anybody help me?
As a general approach to filtering forms or reports, as you can see placing forms! references inside of forms becomes a rather messy business real fast here.
You are best to remove the forms! references from ALL your queries. You then build a form that the user enter the values into, and then execute a browseto command.
The problem you are experiencing here is that the new navigation form swaps out a given form for a new form. This means that the old form is NOT loaded anymore. So, either you
Plan A
Dump use of forms! commands in your SQL queries. This is a good idea anyway since then one query will not blow up because some silly form is not open. And more important the query can be used in other places in the application without fear of some form not being opened.
The instant you place a forms! reference inside of a query is the instant you ruin that query and force "marry" that query to one form that must be opened.
Plan b:
Dump the use of the new navigation control system. Just remember, the new navigation system does NOT load the next form, but "replaces" the one that is being displayed. Thus the previous form is not going to be loaded anymore and thus no forms! ref is allowed. Worse, since the navigation form is really using sub-forms, then the forms! references have to be changed.
You can certainly grab the values of controls and build a where clause in code and use that for openform or open report commands here.
Last but not least, if you in for lots of continued torture, you can stick with your poor design you have now and simply re-edit and fix all of the forms! references to reflect that they are now being used inside of a parent form, and all of your forms are now in effect being run as sub forms.
Try using a dot instead of ! before the property Forms!navigationForm!myForm.myProperty

Customising Symfony Admin Generator Form

I've generated the backend of my application, and am now just 'jazzing' the forms up (adding correct labels, validation rules etc).
One thing I'd like to do is add a map (Google) which updates the marker as an address is entered into the form, then allows the user to drag it to correct the lat/lng should it be a little off.
My question is, how can I customise the output of the form - I've read the docs (1.0,1.1,1.2 also) and it all seems very confusing. Customising forms not generated with the admin generator I know how to do using renderRow(); etc; but finding a way to add a little bit of HTML to the forms is making my eyes hurt! There's so much out of date stuff on the web regarding Symfony it's hard to know what to trust!
If anyone can point me in the right direction that'd be great.
Best Regards,
Rich
Maybe you can start by looking at this plugin : http://www.symfony-project.org/plugins/sfEasyGMapPlugin .
For your question, customizing the forms can be done by creating your own widgets and using them as default widgets.
You may want to read this page : http://www.symfony-project.org/more-with-symfony/1_4/en/05-Custom-Widgets-and-Validators .