A problem with using .dialog box

A problem with using .dialog box

Hello,

I am calling the dialog box from a form.

The dialog opens another form.

I need to send the dialog box parameter of values being captured on the first form.

Because the dialog box is being called on: document.ready, I can't get the values being capture on the first form.

document.getElementById is empty since on document.ready, the user didn't capture anything yet.

Is there a way to call the dialog box on: onClick and  not on document.ready?

Thanks,

Sigal