JS button click delimma

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
gator
Forum Newbie
Posts: 9
Joined: Mon Dec 01, 2003 10:41 am

JS button click delimma

Post by gator »

I would like my submit button (named "filter") in my left frame to automatically fire (or be pressed)
after the submit button in my right frame has been pressed

This was my feeble attempt:

Code: Select all

<body onload="window.document.forms&#1111;0].filter.click">
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

<input type="button" name="buttoninrightframe" onClick="document.parent.frames["leftFrameName"].document.formName.submit();" value="Submit!">

something like that maybe?
gator
Forum Newbie
Posts: 9
Joined: Mon Dec 01, 2003 10:41 am

Post by gator »

Thanks for the promp reply.

I think I'm getting there, I did what you stated but it no-worki :cry:

Changing my 'submit' button to 'button' does nothing.
I changed it back to 'submit' and it just submitted the info to the db just fine.
However it didn't press my "Filter" (submit) button on my left frame.

Code: Select all

<input type="submit" name="update" onClick="document.parent.frames&#1111;"contents"].document.todo_filter.filter();" value="Update">
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

What is the action of the "todo_filter" form?

And do you have any JavaScript bound to the "filter" submit button right now?
gator
Forum Newbie
Posts: 9
Joined: Mon Dec 01, 2003 10:41 am

Post by gator »

action="todo.php" - points to 'todo.php' which uses $filter to filter the form in the right frame.

no JS bound to filter

<INPUT TYPE="SUBMIT" NAME="filter" VALUE="Filter">
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

So, if we submit the form in the left frame, it will do what we want, right? It isn't necessary to press the Filter button since all that is doing is submitting the form anyway, right?

Code: Select all

<input type="submit" name="update" onClick="document.parent.frames&#1111;"contents"].document.todo_filter.submit();" value="Update">
Should submit the todo_filter form when you press on the "Update" button.
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

If it doesn't work, then I suggest waiting for Gen-ik or someone else to answer. Gen-ik's pretty good at this stuff.
gator
Forum Newbie
Posts: 9
Joined: Mon Dec 01, 2003 10:41 am

Post by gator »

Thats a great point, and it made me wonder why I was pointing to 2 different php docs. I simply added the 'filter' code next to my 'update' and 'delete' code which eliminates the need for a JS onClick event.


:?
I spoke to soon. I consolidated the code but I still need an 'onClick' or maybe even an 'onLoad' event to automatically click the filter button.

This was my latest attempt:

Code: Select all

<input type="submit" name="update" onClick="document.parent.frames&#1111;"contents"].document.todo_filter.submit();" value="Update">
Post Reply