Auto-Suggest JavaScript with Radio Button - php

I have one JavaScript through which I am getting a list of companies from memcache with auto-suggest. If I type 're' in the text box, then it will return all the company names that start with 're'.
I have another JavaScript through which I am getting a list of mutual-fund companies from memcache with auto-suggest as well. If I type 're' in the text box, then it will return all the mutual-fund company names that start with 're'.
I would like both to work on the same text box with a radio button that lets the user choose between 'ALL', 'MUTUAL FUND', and 'COMPANY', so if 'ALL' is selected, auto-suggest should suggest from both company names and mutual-fund company names based on the text inputted.
I've written my page in PHP.

Take a look at this tutorial:
http://www.dynamicajax.com/fr/AJAX_Suggest_Tutorial-.html
And then pass the id for the radio buttons

Related

How to get value from multiple drop down fields with the same name

I have added 5 drop down fields in my form with the same name. These field will be displayed based on selected country's radio button.I have 5 radio buttons named as "USA,INDIA,UK,EURO,AUS".
If i select USA, 1st drop down contains US sizes, will be displayed.
If i select INDIA,2nd drop down contains INDIAN sizes, will be displayed.
All are working Good. Now i have an issue with store that value to my DB in magento. When i submit the form, 5th drop down field(EURO sizes) value only saved.
If i select size other than EURO,I got an empty value. If i select Euro size, I got correct value.I hope you understand my problem. Please guide me to solve mine issue guys!
You can add disabled attribute to other drop-downs when you show the selected one. This way the browser will ignore the disabled ones.
Or, you could append [] to your drop-downs' name, like this:
<select name="name[]"> ... </select>
This way you will get an array in the request variable, then you can decide which to use in the array according to your radio button value.

jQuery Autocomplete one input, then populate other relevant inputs?

I'm using the Formidable Pro WordPress plugin to create editable forms. Each form has several different "Contact Info" areas (in the below picture, one such area is "General Contractor", and another one is "Mechanical Engineer"), and each area has several inputs.
What I'm looking to create:
Enter first few letters of persons name in "Contact" input
Select a name from resulting Autocomplete drop-down
Populate nearby fields with Contact's respective information (Company, Email, Phone, Fax, Tax ID, and Address)
The first image below shows two of the "Contact Info" areas (the first of which I drew in each input's ID). The second image shows how each Contact's information is stored in a MySQL table.
So are there any Autocomplete WordPress or jQuery plugins that can help me accomplish this, and if so, how would I go about implementing this feature?
I'm guessing for the drop-downs you're using dynamic fields? Replace these with Lookup fields and then you can automatically populate values of other fields like so:
For each field you want auto-populated, go into the field settings and check the option 'Dynamically retrieve the value from a Lookup field'. Then, for the 'Get value from' options, you'll need to select the form and field you want to Get the data from. Then, for the 'Watch Lookup fields' option you'll need to select the lookup field (which will be your 'Contact' input that users are typing into).

How to change an html paragraph text based on selected radio button?

I have been developing a course management system with PHP and MySQL. I recently ran into a problem. I created a basic webpage (EditCompletion.php). Basically, what I want to do, is have a link on that page that opens a jQuery Modal Window and within that modal window should be 3 radio buttons, a small description paragraph (which changes when a new radio button is clicked), and a submit button. This is how I want it to work:
I want to be able to select a student (CERTAIN SELECTED STUDENT) and a lesson (CERTAIN SELECTED LESSON) then I want to be able to click the link on EditCompletion.php that then opens the jQuery Modal Window. I want to then be able to choose from the following options:
Unlock - (Description Paragraph - Are you sure your want to unlock (CERTAIN SELECTED LESSON) for (CERTAIN SELECTED STUDENT))?
Exempt - (Description Paragraph - Are you sure you want to exempt (CERTAIN SELECTED STUDENT) from (CERTAIN SELECTED LESSON))?
Master - (Description Paragraph - Are you sure you want to master (CERTAIN SELECTED STUDENT) out of (CERTAIN SELECTED LESSON))?
THE CERTAIN SELECTED will show up as the CURRENT SELECTED [WHATEVER]. For example, SELECT STUDENT JOHN DOE and LESSON 1 on EditCompletion.php and then click the link to open the modal. I want to select an option using radio buttons, and upon clicking "save", the MySQL database would be updated.
something like this?
<?php
for($samples as $sample){
echo '<a onclick="return (confirm(\'..message here.. for '.$sample['name']. 'about'.$sample['lesson'].'\'))? true: false;">Action</a>';
}
?>

Displaying dynamic text based on drop down box selection

I am using Dreamweaver to create a site.
I have created my database within phpMyAdmin and have two tables set up that contain the data I wish to display on my site. (it is a football team site and the page I am editing displays player profiles).
I have set up a drop down box, which is connected to my players table in phpMyAdmin. This I have set to display surname of the player. (I've set up the recordset to retrieve all data from my "players" table)
Below that, I have another div which contains text that I want to display based on the selection on the drop down list. For example, Position, appearances, goals, assists, etc.
Position: Dynamic text to be displayed here
Appearances: Dynamic text to be displayed here
etc
(This data would come from the "players_info" table - but the two tables are connected via the player_id field which is contained in both)
What I can't seem to do is work out how to get the text to update when the user would select a player from the drop down list.
Any help would be greatly appreciated.
Thanks
James
You can do these using ajax function.
when you select a player name ,then javascript or jquery event will be called which include a php file.
This php file must contain the sql which fetch your desired player information.
when server give response, then display it your corresponding div

Show a text value after making a selection in a drop down box

I'm building a web-app that allows people to select their US state from a drop-down box, displaying a telephone number for that area, however I'm having some difficulty doing so.
I've built the rest of the site in PHP and realise that this is a client side action, so I'd need to use JavaScript or Jquery.
Each state has a different number, so for example when Columbia is select I want to show the number for Columbia in a div next to the text box.
The values can be stored in a MySQL database if needed.
Any help would be greatly appreciated.
When you pull the data out to put into the drop down box store the telephone number as the 'value' of each option.
Then you can just set the div text to be $('getCheckBox').val().
$('dropdown').change(function(){
id = $(this).val();
myFucntionDoToWhateverIwantItToDo(id);
});
function myFucntionDoToWhateverIwantItToDo(id){
// Do stuff in the div, baby. The ID is stored in id.
$("div").empty().append(id);
}
Obviously replace dropdown and div with their real ids or classes

Categories