CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 11th, 2003, 03:09 PM
clevatreva clevatreva is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Stratford-upon-Avon, UK
Posts: 66 clevatreva User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
2 forms to submit using one (CSS) button

Hi All (my first post here),

I've got a page with a form on, and a separate hidden form with an 'action' variable in (this is much shortened version!):

PHP Code:
<FORM NAME="pageEditForm" METHOD="post">
<
INPUT NAME="pagename" type="text" size="20" maxlength="20" value="main">
</
FORM


Another form is hidden:

PHP Code:
<FORM NAME="hiddendiscardpageform" METHOD="post">
<
INPUT NAME="action" TYPE="hidden" VALUE="discard">
</
FORM


The code for the button is:

PHP Code:
<DIV CLASS="BJ_menuElement"
 
onclick="javascript:document.hiddendiscardpageform.submit();document.pageEditForm.submit();"
 
onmouseout="this.className='BJ_menuElement';"
 
onmouseover="this.style.cursor='pointer';this.className='BJ_menuElementHover';">
<
CENTER>Discard Changes</CENTER></DIV


Submitting one page is OK in the 'onclick', but the above sends only the last page in the list.

Reading on earlier posts, it seems one solution (acceptable to me if I can get it to work) is to post the 'action' from 'hiddendiscardpageform' to 'pageEditForm'.

Why a CSS button, instead of a normal submit button? The whole site uses these (menu's, etc), so it's in keeping with the theme.

Why not just put the action bit in the other form? Because there are five buttons on the page with different actions, but all send the information from the pageEditForm.

What do I need to change to get this to work? Any help would be MUCH appreciated, as I have been stuck on this for weeks, and despite trawling the web, can't find the answer (or more likely I'm too simple to see it ).




Trevor
__________________
"Good artists copy, great artists steal." Pablo Picasso

Reply With Quote
  #2  
Old September 12th, 2003, 03:43 PM
clevatreva clevatreva is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Stratford-upon-Avon, UK
Posts: 66 clevatreva User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Hi

Well, as someone said, 'the silence was deafening'!

I eventually figured it out. Instead of the button doing the submit, make it go to a javascript function. In that function, make the hidden values in one form equal those in the other, and then submit the form.

In my case, I did away with most of the hidden forms and used javascript variables instead.





Trevor

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > 2 forms to submit using one (CSS) button


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway