Marc Boncz wrote:
> Hi all,
>
> I know this is not the Javascript list but still...
> Am designing a webinterface for an intranet application for a client and for
> one of the form fields a huge amount of options is available. Too many to
> use a dropdown menu as one would normally do (should choose a client from
> their customer database).
>
> Thus handiest now looks like making a textinput for the customer code.
>
> But the operator will not know the customer code by heart, so I made a
> button next to this field opening a popup with a search for the right
> customer (by name, phone number, email, so the employee can find the right
> customer quickly from his contact info). All OK so far.
> Now having found the customer in the popup I want to fill in the textinput
> on the main form using a button and an onclick action. This should be
> something like below, isn't it? This is what I put as the action:
>
> onclick="main_form_%ID%.formname.fieldname.value='.$Customer[$CustomerID].'"
>
> Of course the main form has an id set to main_form_%ID% where %ID% is
> derived from the session, and the formname and fieldname match.
>
> But nothing happens, the textfield stays empty
>
> What is going wrong?
>
> Or: to give some help: want to fill in a textfield in page 1 using a button
> action in page 2 without reloading page 1. What to do (must be Javascript,
> but what?)?
>
> Marc
>
>   
Hey Marc,
I'm attempting the same thing rigt now. Here is code that works when not
inside another form. And that might be your problem too.
You use a form to open the new popup, don't you? But you want your value
to be copied into another field on the same page but in another form. If
so, here is the code, maybe someone can help out that knows more about java.

Filename pop.html
[code]
<body>
<form name="frmGetCustomer">
<input type="button" name="opener" value="Click to pop up"
onClick="popUp();">
<input type="text" name="holder" value="" size="25">
<br>

</form>
<script language="JavaScript">
<!--
function selectItem(){
    var selindex=document.frmGetCustomer.myselect.selectedIndex;
    if (selindex!=0)
{document.frmGetCustomer.holder.value=document.frmGetCustomer.myselect[selindex].value;}
}

var wi=null;
function popUp(){
   if (wi) wi.close();
  
wi=window.open("popup.htm","","width=600,height=300,location=no,scrollbars=no,status=no");
}
//-->
</script>
</body>
[/code]

Filename popup.html
[code]
<html>

 <head>
  <title>pop up</title>
  <script language="JavaScript">
<!--
function selectItem(){
    var selindex=document.popUpForm.myselect.selectedIndex;
    if (selindex!=0) {
       window.close();
      
window.opener.document.myForm.holder.value=document.popUpForm.myselect[selindex].value;
    }
}
//-->   
  </script>
 </head>

 <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
 <br>
 <form name="popUpForm">
 <select name="myselect" onChange="selectItem();">
 <option></option>
 <option value="value1">option 1</option>
 <option value="value2">option 2</option>
 <option value="value3">option 3</option>
 <option value="value4">option 4</option>
 <option value="value5">option 5</option>
 <option value="value6">option 6</option>
 <option value="value7">option 7</option>
 </select>
 </form>
 </body>

</html>
[/code]

----
Skylinux
http://www.network-technologies.org




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to