javascript in zend_Form_Element_Text - zend-framework

I have an autocompexion app. that works. Server side written in php (search.php)
. Client side in javascript (autocomplexion.js).
In a text field this helps to enter town name by giving towns names that starts with the same letters that are entered in the field.
search.php sort a list of towns in towns.txt and choose the ones that match.
autocomplexion.js helps to select among those proposed towns.
My issue :
In Zend i would use this in a form (zend_Form) in a text field created with Zend_Form_Element_Text.
How do i link this field with autocomplexion.js and search.php.
where do i put search.php and autocomplexion.js
Thanks for your answer
Patrick

Write the PHP search function in an Action in an appropriate controller. Point the JS to this action and I think you are done.

Related

Sharepoint Rest Api Search query, getting a field with rich text

I am trying to get a field with a rich text but it is striping all the html in the search query. Is there a way to get the html rather than the rich text?
https://{domain}.sharepoint.com/_api/search/query?querytext=%27claim%27&selectproperties=%27Title,Question,Answer%27
<d:Key>Answer</d:Key>
<d:Value xml:space="preserve"> See THIS Form​ . ​ </d:Value>
Answer is the Rich text field with a link in it, When I do a GET (_api/web/lists/getbytitle), it comes back with a link in that field.
Basically, I want to avoid having to call search then call a GET to replace the values.
I solved this by looking through the search properties and using the ID in the path to use a GET List
_api/web/lists/getbytitle('title')/items('1')
then replacing the column in search with the rich text with the one from the GET.
I only need 3 results or so, so this was not a problem for me.
It looks like in the search query, doesnt give back any html tags for the rich text column.

cfinsert is picking up my search input field in a different form

When I submit my form I am getting an error from my cfinsert function because there is not a database column name "SEARCHFIELD". The problem is "SEARCHFIELD" is not an input in the form I am submitting.
Both forms have close and open tags so I am not sure why my search form input is being referenced in my main forms submission?
Any thoughts?
Two ways I can think of to avoid this, without seeing your actual code it is hard to guess where SEARCHFIELD is coming from. As some of the comments pointed out it would most likely be from a CFPARAM or the name of your submit button in the form.
The first way you could tackle this is the CFINSERT tag has an attribute named formfields where you can list off the columns you wish to insert with. You can see that here in this doc link:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7c78.html
Another way you could do this is you could add code to remove SEARCHFIELD from the FORM scope prior to running the CFINSERT. Which would be as simple as:
<cfset StructDelete(FORM, "SEARCHFIELD") />
You could check to see if it exists and if so then delete it but the StructDelete() will run without issues even if the field does not exist.
I personally do not use CFINSERT/CFUPDATE and I know the default opinion in the community is not to. They do have some benefits though that often are overlooked in that they do parameterise the SQL and offer at least some safety from malicious people. Without knowing anything about what you are doing it is hard to say if using them is actually a shot in your foot in the long run or something just fine to be doing.

Alter input of form before it is submitted

I'm creating a multilingual Drupal site and trying to implement a search function, that only displays results in the current language, that the user is viewing the site through.
Using Drupals own searchfunction at /search/node it is possible to select which language to search for through the "Advanced search" options, and it works perfectly. However, I dont want to expose these language selectboxes, I just want it to only search in the current language automatically.
What's the best option to do this?
I have one solution where I create a hook_form_alter function, that sets the #default_value in the language selectboxes to the current language, and then I hide the whole "advanced options" with in css. This doesnt seem very right though.
I think the most clean solution would be to hook into Drupals form-processing process and append ex "language:en" to the input text, but I cannot get this to work.
Does anyone know if it is possible via one of the Drupal form related alter functions, to get a hold of the input text and alter it before drupal does its final processing of it?
To answer your question specifically, while using 'hook_form_alter', you have a referenced variable called '$form_state'. This stores the values in the form, and any change there will be passed further.
Also,
I think setting a default value and hiding the field is a good solution as any, only, if you are hiding it you should do it server side, while altering the form. The same field you are setting the default value to. like this:
$fieldname['#type'] = 'hidden'.

Salesforce: Auto-complete for Lookup field

I have a custom object known as "Companies".I have created a lookup field in a Visual Force page which gives me the list of companies name from the custom object " Companies".I have written a code which makes this lookup field auto-complete like what you have seen in the image attached.(First pic)
The problem: I don't know how to make the lookup field (which takes the list of companies name from custom object" Companies" in "Opportunities" standard object) auto-complete as done in the visual force page. Basically want the field highlighted in yellow in the second picture to auto-complete or give relevant suggestion when I type the first few characters.
Any help on this matter would be appreciated. Thank you
Have you tied enabling Auto Complete for your custom object the search page?
Click Your Name | Setup | Customize | Search | Search Settings.
Check the Lookup Auto-completion check box for your object.
This will give you auto-complete options for recently used items.
http://help.salesforce.com/help/doc/en/search_lookupdialog.htm#auto_complete
You will not be able to embed this customization into a standard page layout like you're using for the Opportunity object in your second screenshot. If that auto-complete is a must-have, then you really only have two options:
Replace the entire Opportunity page layout with a custom VF page
Write a VF component with just the Company lookup field in it and embed it into your Opportunity page layout (this will have to be in its own section, which probably won't look as nice)
This is what you want - http://tapp.ly/autocomplete/
Autocomplete Lookups for Salesforce enables any Salesforce Lookup field to support autocomplete suggestions. Autocomplete Lookups helps your users enter lookup fields reducing data entry tasks and error rates.
Salesforce records suggested as you start typing
Search All fields (Standard Salesforce Lookups only let you search by the Name field)
Results can show any field (E.g. Case Subject rather than Case Number)

Customizing single entry templates in ExpressionEngine (1.6.x)

This is either very annoying or very embarrassing. I've set up most of my blog, but I can't figure out where or how the heck I set up single entry templates as opposed to the section/weblog containing them. I just can't find information on how to do it for the life of me.
This is especially important, because I want to define the canonical link for all entries, since ExpressionEngine links to entries in all kinds of ways.
So, the case is that I have a Blog section/weblog with an index working as the front page for mydomain.com. This lists all my entries as you would imagine a regular blog to do. The problem arises when I need to customize the code for the single entries' links.
If you have a template set up already which is showing a multitude of entries and you want a single entry page for each entry then what you need to do is this :
{exp:channel:entries
channel="default_site"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
Then in the template shown above by template_group/template_name (please change those to whatever your template group and template names actually are ;-) ) you will place this code :
{exp:channel:entries
channel="default_site"
limit="1"
dynamic="yes"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
This will then show you just the one entry as you will have used the {url_title_path="template_group/template_name"} in the first channel entries tag above which would basically create a URI something like this :
http://www.example.com/template_group/template_name/url_title_of_my_posted_entry
On the second (template_group/template_name) single entry template page it will see the URL title and use this to filter down the channel entries tag to just that one entry.
Hope that helps a bit.
Best wishes,