SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

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 Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 10th, 2004, 03:21 PM
Rockjmb Rockjmb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Rockjmb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
onClick and Pull Down Boxes

Form works with select button,
doesn't work onClick. JS is enabled on page. Newbie PHP but getting better. No JS background.

Code is as follows:

<table border = "2" class='form'>
<tr>
<th>Business Categories</th>
</tr>
<tr>
<td>
<form name="Trianglecategories" method = "post"/>

<input type="hidden" name="category" value="category" onclick="document.Trianglecategories.setAttribute('action', 'Categoryindex.php')"/>
This remark not in code---the require below Contains all Options----
<?php require("Trianglecategories.php")?>


<input class="submit" type="submit" name="submit" value="GO"
onclick="document.Trianglecategories.setAttribute('action', 'Categoryindex.php')" >

</form>

</td>
</tr>
</table>

Question: Is document a reserved JS word or should this be the path to Trianglecategories

ps. put onclick in both places in desperation!

Any help is appreciated


Reply With Quote
  #2  
Old November 10th, 2004, 03:47 PM
System System is offline
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Posts: 665 System User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Message Moved

Thread moved from 'PHP Coding' to 'Client Side Things' by nawlej.

Reason: javascript related.

Reply With Quote
  #3  
Old November 10th, 2004, 03:51 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: onClick and Pull Down Boxes

what is it that you want to happen? it is not clear what you are trying to do. Also, onclick in the hidden field is not needed. Let me know what you want to do and I will see if I can help.

Reply With Quote
  #4  
Old November 10th, 2004, 04:00 PM
Rockjmb Rockjmb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Rockjmb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: onClick and Pull Down Boxes

Want each of the options in the pull down to take action on either a click within the box or by clicking on the sumbit button "GO"

Reply With Quote
  #5  
Old November 10th, 2004, 04:10 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: onClick and Pull Down Boxes

in dropdowns, use the onchange event, not the onclick. you will also need to include the submit() method for this to work. Post the code for the dropdowns and I will put together an example.

Reply With Quote
  #6  
Old November 10th, 2004, 04:21 PM
Rockjmb Rockjmb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Rockjmb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: onClick and Pull Down Boxes

Not sure which pull down code you are looking for besides what I aready posted but here is a subset of the reqire code

<!-- START of Trianglecategories.php -->
<?php $category = 'Select'?>
<select name='category'>
<option value="<?php echo $Category;?>" SELECTED><?php echo $category;?></option>
<!-- add, remove or change any of the select option items below. -->
<option value="Grand Openings">Grand Openings</option>
<option value="Shopping Destinations">Shopping Destinations</option>
</SELECT>

<!-- END of categoriesINDUSTRY.php -->

Reply With Quote
  #7  
Old November 10th, 2004, 04:36 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: onClick and Pull Down Boxes

here is what you do... change the select tag like so...one thing I should mention first, is that you have two form elements with the same name (the hidden field and the select...not sure what the hidden field is for)which will cause problems.

<select name='category' onchange="document.Trianglecategories.setAttribute('action', 'Categoryindex.php');document.Trianglecategories.s ubmit();" >

That will submit the form each time a new selection is chosen. Another thing, is the action attribute of the form going to be different for the dropdown and the submit button? If not, I would just hard code the action attribute in the form tag and remove the setattribute commands as it would be overkill.

Reply With Quote
  #8  
Old November 10th, 2004, 04:44 PM
Rockjmb Rockjmb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Rockjmb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: onClick and Pull Down Boxes

Got it... I'm grab a bite to eat first,change the code and test it out, and get back to you ...much appreciated!

Reply With Quote
  #9  
Old November 10th, 2004, 05:38 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: onClick and Pull Down Boxes

No change in form behavior
Form works by using the submit "go" button but does not take "action" on selecting anythig within the pull down box

I must still be doing something wrong.
I Changed the code to:

<td>
<form name="Trianglecategories" method = "post"/>

<?php require("Trianglecategories.php")?>

<input class="submit" type="submit" name="submit" value="GO">

</form>

</td>




<!-- START of Trianglecategories.php -->
<?php $category = 'Select'?>
<select name='category' onchange="document.Trianglecategories.setAttribute('action', 'Categoryindex.php');document.Trianglecategories.s ubmit();" >

<option value="<?php echo $Category;?>" SELECTED><?php echo $category;?></option>
<!-- This MUST be line 20: Add, remove or change any of the select option items below. -->
<option value="Grand Openings">Grand Openings</option>
<option value="Shopping Destinations">Shopping Destinations</option>
</SELECT>

<!-- END of categoriesINDUSTRY.php -->

Reply With Quote
  #10  
Old November 10th, 2004, 06:43 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: onClick and Pull Down Boxes

lets simplify it a little first hard code the form action and change the name of the submit button to catsubmit (nameing it submit interferes with the submit() method sorry but I missed that before)

<form name="Trianglecategories" method = "post" action="Categoryindex.php"/>

<?php require("Trianglecategories.php")?>

<input class="submit" type="submit" name="catsubmit" value="GO">

</form>


then in the trianglecategories.php use this code

<?php $category = 'Select'?>
<select name="category" onChange="document.Trianglecategories.submit();" >
<option value="<?php echo $Category;?>" SELECTED><?php echo $category;?></option>
<option value="Grand Openings">Grand Openings</option>
<option value="Shopping Destinations">Shopping Destinations</option>
</SELECT>

that should do it

Reply With Quote
  #11  
Old November 11th, 2004, 09:55 AM
Rockjmb Rockjmb is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Rockjmb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: onClick and Pull Down Boxes

Works like a charm! Thanks Muchly!

Is there an online JS Manual similar to PHP?
At this site?

ps

Sliced Bread is not my favorite, I like French and Italian, the kind you slice yourself! But presliced is convenient!

Thanks again




Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > onClick and Pull Down Boxes


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 1 hosted by Hostway