Pick List Functionality

J

Jerry Camel

I'm using a DHTML dialog to present a pick-list to a user.
I've got the dialog working using some client side vbscript with a
call to window.ShowModalDialog.

I can see that the result is being returned to the main form, but I can't
figure out how to get it into the textbox the user is trying to populate.
The textbox is a server control. I tried setting the Text property of the
textbox to the result of the
dialog, but it just errors out claiming that an object is required.

Thoughts and ideas...? Please?

Jerry
 
M

Martin Dechev

Hi, Jerry Camel,

Your problem should be solved completely on the client side.

Pass the document object when calling ShowModalDialog and then access it to
modify the value of the textbox:

showModalDialog("some.aspx", document, ...)

After that (in the modal dialog):

dialogArguments.forms[0].Textbox1.value = ...

The code is in javascript, but in vbscript you should only replace the []
with () and it will work.

Hope this helps
Martin
 
J

Jerry Camel

Thank you, Martin - Got exactly what I needed from that.

Martin Dechev said:
Hi, Jerry Camel,

Your problem should be solved completely on the client side.

Pass the document object when calling ShowModalDialog and then access it to
modify the value of the textbox:

showModalDialog("some.aspx", document, ...)

After that (in the modal dialog):

dialogArguments.forms[0].Textbox1.value = ...

The code is in javascript, but in vbscript you should only replace the []
with () and it will work.

Hope this helps
Martin
Jerry Camel said:
I'm using a DHTML dialog to present a pick-list to a user.
I've got the dialog working using some client side vbscript with a
call to window.ShowModalDialog.

I can see that the result is being returned to the main form, but I can't
figure out how to get it into the textbox the user is trying to populate.
The textbox is a server control. I tried setting the Text property of the
textbox to the result of the
dialog, but it just errors out claiming that an object is required.

Thoughts and ideas...? Please?

Jerry
 
J

Jerry Camel

Alright... Now I'm just confused.

Simple testing:
This worked just fine in testing when I set the return value equal to a hard
coded string. But when I try to set the return value equal to the value of
a textbox on the dialog form, nothing seems to get back to the original
form. No error, just no result returned.

Problems with more detailed testing included buttons, etc. that would cause
a postback of the dialog form: When the postback occurred, I ended up with
a third IE window with a duplicate of the dialog. What's happening?

Thanks

Jerry

Martin Dechev said:
Hi, Jerry Camel,

Your problem should be solved completely on the client side.

Pass the document object when calling ShowModalDialog and then access it to
modify the value of the textbox:

showModalDialog("some.aspx", document, ...)

After that (in the modal dialog):

dialogArguments.forms[0].Textbox1.value = ...

The code is in javascript, but in vbscript you should only replace the []
with () and it will work.

Hope this helps
Martin
Jerry Camel said:
I'm using a DHTML dialog to present a pick-list to a user.
I've got the dialog working using some client side vbscript with a
call to window.ShowModalDialog.

I can see that the result is being returned to the main form, but I can't
figure out how to get it into the textbox the user is trying to populate.
The textbox is a server control. I tried setting the Text property of the
textbox to the result of the
dialog, but it just errors out claiming that an object is required.

Thoughts and ideas...? Please?

Jerry
 
M

Martin Dechev

Hi, Jerry,

see inline ->

Jerry Camel said:
Alright... Now I'm just confused.

Simple testing:
This worked just fine in testing when I set the return value equal to a hard
coded string. But when I try to set the return value equal to the value of
a textbox on the dialog form, nothing seems to get back to the original
form. No error, just no result returned.

Most probably you don't reference the objects properly. Try alert-ing the
values until you find out the solution.
Problems with more detailed testing included buttons, etc. that would cause
a postback of the dialog form: When the postback occurred, I ended up with
a third IE window with a duplicate of the dialog. What's happening?

It is by design, I think (I haven't seen it documented though). All you have
to do is add the following tag in the head section of the html:

<base target="_self">

Other solution is to work in a frame or iframe thus posting inside it. It
requires more coding, but the titlebar text doesn't change after a postback.
It does change in the first solution.

Greetings
Martin
Thanks

Jerry

Martin Dechev said:
Hi, Jerry Camel,

Your problem should be solved completely on the client side.

Pass the document object when calling ShowModalDialog and then access it to
modify the value of the textbox:

showModalDialog("some.aspx", document, ...)

After that (in the modal dialog):

dialogArguments.forms[0].Textbox1.value = ...

The code is in javascript, but in vbscript you should only replace the []
with () and it will work.

Hope this helps
Martin
Jerry Camel said:
I'm using a DHTML dialog to present a pick-list to a user.
I've got the dialog working using some client side vbscript with a
call to window.ShowModalDialog.

I can see that the result is being returned to the main form, but I can't
figure out how to get it into the textbox the user is trying to populate.
The textbox is a server control. I tried setting the Text property of the
textbox to the result of the
dialog, but it just errors out claiming that an object is required.

Thoughts and ideas...? Please?

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top