Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onsubmit event

Status
Not open for further replies.

marianmarian

Programmer
Jan 17, 2003
40
CA
hi,

i am working on this form:

in the form i have a button, when you click on the button, a new window is opened, but before a new window is opened, it submit the form fields. for a new window to be opened, i parse the new window link with an id.

problem, id is blank as an id is auto generated from the database, and i cannot parse it together while the form submit and a new window is opened at the same.

question, is there a way that i can grab that id from the database and parse it immediately to the url link and open a new window.

note also that when i click on the button that is supposed to open the new window, the button submit the form fields as well on click.

thanks,
Marianmarian
 
Sure you can submit the form and open the window:

Code:
function OpenNewWin(id){
   document.formName.submit();
   Window.Open(("some.asp?intID="+id+"", "title", "toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,width=250,height=120,top=300,left=500");
}
<input type="button" name="submit" value="Submit" onClick="OpenNewWin(<%=rs("ID")%>);"
 
thanks for the help, but somehow i am not getting the window to be opened:

<script>
function openWin()
{
document.myForm.submit();
Window.Open("add.php?id=$theID&screen=group&sid=$gID','Collaboration','width=600,height=400");
}
</script>

<INPUT type="button" value="+" onClick="openWin();">

thanks for your help
 
I don't know PHP. Where do you define $theID, group, and $gID?
 
It might not be PHP. She's not closing her third parameter.

[tt]
<script>
function openWin()
{
document.myForm.submit();
Window.Open("add.php?id=$theID&screen=group&sid=$gID','Collaboration','width=600,height=400[red]'[/red]");
}
</script>

[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
it is php; sorry.

$ is how you begin to declare a variable in php . ok ignore the tags or the parsing of the variables, but i still can't open new window.

thanks
 
Sorry, should be:
[tt]
<script>
function openWin()
{
document.myForm.submit();
Window.Open('add.php?id=$theID&screen=group&sid=$gID','Collaboration','width=600,height=400');
}
</script>
[/tt]

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
<script>
function openWin()
{
document.myForm.submit();
Window.Open("add.php','Collaboration','width=600,height=400");
}
</script>

<INPUT type="button" value="+" onClick="openWin();">

with this, i still can't open a new window
 
You are STILL missing the changes I addressed.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
marian, reread cLFlaVa post.

It should be:

<script>
function openWin()
{
document.myForm.submit();
Window.Ope('add.php','Collaboration','width=600,height=400');
}
</script>
 
by the way cLFlaVa, how do I bold a text in my post?
 
[ignore]like this![/ignore]

And to print out the tags without using them, use

[ignore][ignore]this[/ignore][/ignore]

The link "Process TGML" at the bottom of the page will tell you more.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Kendel,

click on the 'Process TGML' link below the textarea where we enter comments to post. There is a whole array of things you can do (besides "bolding" text... which is done by putting b's around the text as: [ignore]Bold Text[/ignore]).

--Dave
 
i did this already and it still doesn't work!

<SCRIPT>
function openWin()
{
document.grantsForm.submit();
Window.Open("add.php","Collaboration","width=600,height=400");
}
</SCRIPT>

<INPUT type="button" value="+" onClick="openWin();" class=button id=$gID>

i cannot open a new window still help
 
[tt]
function openWin()
{
document.grantsForm.submit();
window.open("add.php","Collaboration","width=600,height=400");
}
[/tt]

Make sure you pay special attention to case-sensitivity in JavaScript. It makes a world of difference.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
thanks, but something weired is happening:

document.grantsForm.submit(); doesn't submit, but a new window opens with the window.open(blablabla), why, help.

onClick="document.grantsForm.submit(); window.open();"

thanks for all your responses
 
It's impossible for us to tell what's going wrong by simply posting psuedo-code of where you think the problem is. Once again, we'll need actual code.

Is your form's name actually grantsForm, and is the F in grantsForm really capitalized?

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top