?
Solved

link or button to open window, choose value, and return

Posted on 2005-05-13
17
Medium Priority
?
475 Views
Last Modified: 2012-06-21
hello all

i have some form in a php file

nothing but normal.

so i need some users to choose a part number from a very very large listing. 10 times
but if i put the listing 10 times the page will result slow to load wich i dont want to.

Im thinking on mabe a link to open a window with the full listing for the user to choose, and a button to go back with the selected value and put it in the field wich he left from.

Something like this

row  code  
0     [________]  (choose link or button)
1     [________]  (choose link or button)
2     [________]  (choose link or button)
3     [________]  (choose link or button)
4     [________]  (choose link or button)
5     [________]  (choose link or button)
6     [________]  (choose link or button)
7     [________]  (choose link or button)
8     [________]  (choose link or button)
9     [________]  (choose link or button)

ive tried with forms and php but nothing working yet.

Is there a way to do this?

Thanks in advance.


0
Comment
Question by:HTorres
  • 9
  • 5
  • 3
17 Comments
 
LVL 7

Expert Comment

by:jdpipe
ID: 14001151
Here are some ideas:

* load the list of products into a javascript array, then populate the select boxes from that array, rather that using static HTML
* implement a little AJAX auto-complete gizmo like Google Suggest
* use a popup which writes the product ID into the box (as you mentioned)
* use an IFRAME with the product list

Is cross-browser support important here? Does the solution need to failsafe for non-javascript browsers? Do you have a preference for the solution?

JP
0
 
LVL 7

Expert Comment

by:jdpipe
ID: 14001157
Hmm -- these product numbers must correspond to product names right... is there any more information that needs to be presented at the same time, or is that it?
JP
0
 
LVL 4

Author Comment

by:HTorres
ID: 14001366
JDpipe

- how do i do the javascrip array and populate the select boxes from that array?
- how do i implemente the ajax auto complete gizmo like google suggest?
- how do i retrieve the product from the popup  back into the form?
- how do i use an iframe with the product list

im not interested in cross browser, 99% of people has IE, (not that im happy with it) but lets work with IE.

thanks in advance
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 7

Expert Comment

by:jdpipe
ID: 14001391
well let's think about how your users are going to use this. the part number, is that something that people will learn off by heart sometimes, or will they always have to look it up?
how much information needs to be shown next to the part number in order that the person can make a good selection?

JP
0
 
LVL 4

Author Comment

by:HTorres
ID: 14001404
they will ALLWAYS have to look it up...

i kwnow my users.
...

they need a listing
something that tells them what is what they need.


it is that way.
:(


but.. thats what we R for!
0
 
LVL 7

Expert Comment

by:jdpipe
ID: 14001406
ok so what data will be shown alongside the part number?
0
 
LVL 4

Author Comment

by:HTorres
ID: 14001426
nothing, just the part number
0
 
LVL 7

Expert Comment

by:jdpipe
ID: 14001436
well it sounds like a select box is the simplest then, don't you agree? how many part numbers are we talking here?

JP
0
 
LVL 4

Author Comment

by:HTorres
ID: 14001615
1500 to 4000
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 14001835
Using some javascript you can create a simple selection application:

A simple form could look like this:
<html>
  <script type="text/javascript">
    var frmElem;
    var cldWindow;
    function setValue(val)
    {
      if(frmElem)         frmElem.value = val; //
      if(cldWindow)      cldWindow.close();
    }
   
    function loadListing(targetElement)
    {
      frmElem = targetElement; //store the target element
      cldWindow = window.open('test.php?showPartListing','parts','width=200,height=200');
    }
   
  </script>
 
  <form>
    <input type="text" name="field1" /><input type="button" onclick="loadListing(this.form.field1);" value="Select item"/><br/>
    <input type="text" name="field2" /><input type="button" onclick="loadListing(this.form.field2);" value="Select item"/><br/>
    <input type="text" name="field3" /><input type="button" onclick="loadListing(this.form.field3);" value="Select item"/><br/>
    <input type="text" name="field4" /><input type="button" onclick="loadListing(this.form.field4);" value="Select item"/><br/>
    <input type="text" name="field5" /><input type="button" onclick="loadListing(this.form.field5);" value="Select item"/><br/>
    <input type="text" name="field6" /><input type="button" onclick="loadListing(this.form.field6);" value="Select item"/><br/>
  </form>
</html>

The test.php?showPartListing could be any php which generates something like:
<html>
  <style type="text/css">
    button {background:white;border:none; cursor:pointer;color:blue;text-decoration:underline;display:block;}
  </style>
  <button onclick="window.opener.setValue('part 1');">Part 1</button>
  <button onclick="window.opener.setValue('part 2');">Part 2</button>
  <button onclick="window.opener.setValue('part 3');">Part 3</button>
  <button onclick="window.opener.setValue('part 4');">Part 4</button>
</html>

Hope this helps, as it sound much easier than ajax components whatever that might be.

-r-
0
 
LVL 4

Author Comment

by:HTorres
ID: 14003569
Hi  Roonaan

I guess I need to know a much more javascript.

please let me run some test on what you posted

thanks in advance.

0
 
LVL 4

Author Comment

by:HTorres
ID: 14003593
It works great!!!!!!!!!!!!

THATS WHAT I NEED!

... how can I make it a dropdown list?

I just need to set the onclic value between the <option></option> tags?
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 1200 total points
ID: 14003694
When using a dropdown you could have a form like:


<form onsubmit="window.opener.setValue(this.mySelect.options[this.mySelect.selectedIndex].value);return false;">
 <select name="mySelect">
  <option value="part1">Part 1</option>
  <option value="part2">Part 2</option>
  <option value="part3">Part 3</option>
 </select>
 <input type="submit" value="Select" />

</form>

-r-
0
 
LVL 4

Author Comment

by:HTorres
ID: 14003713
Excelent!

that did the trick!

Thanks Roonaan!
0
 
LVL 4

Author Comment

by:HTorres
ID: 14003722
wow Roönaän!
6 certifications?

what u recommend to learn php, mysql, and javascript?

ive seen some books but most of them are basical.
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 14003744
As foor books, I currently have only two books (Php zend certification study guide, and a mysql book from paul dubois which i use for back reference).
Although possibly sounding quite silly, the best way to pick up things is to start your own little projects, and getting yourself familiar with the way sites like php.net, w3schools.com and mysql.com work. Those three sites contain lots and lots of manual/references and proof themself worth the effort when you get to know your way around.

Also, although I had a large deal of knowledge befor I started here at EE august last year, I noticed that I have stored loads of information just by reading questions here at EE. Although often there are other experts quicker than I am, or you are; taking the time to figure out problems increases your understanding of how the three languages work themself and when you combine them.

-r-



0
 
LVL 4

Author Comment

by:HTorres
ID: 14003762
thanks.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question