Jump to content


Photo

Hide and show different hidden fields with javascript.


  • Please log in to reply
1 reply to this topic

#1 woodhacker98

woodhacker98
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 August 2006 - 08:46 PM

Hi!

I have a form with a lof of hidden fields (basically a search form that will pass some variables to a non editable php CMS system to search in different categories - and I MUST pass exactly the right variables to the php script ). I apply values with DOM in the different hidden fields based on which radiobutton the user has selected. If he selects "web" radiobutton, I apply values to a number of fields with a function when the user has pushed the submit button. 

The rest of the hidden fields doesn't get any values, and shows in the adressfield in the browser like this: ....&variable1=&variable_not_used=& and so on...

The script is running perfect.. But now I have a little problem..  I have to extend the script with a new radiobutton to search in a new category. And when I search in a new category, the phpcms system doesn like one of the other variables i send in GET, even if it is blank/unset.. Yes the system suck.. But I cant do anything about it..

Therefore this question:

Is it possible to "hide" a hidden element in a form,  and do it "visible" when I need it? So it doesnt beeing sent with the GET action?

I have tried with:

<div id="hide_me" style="visibility:hidden">
<input type="hidden" name="news" value=""></div>

But this only works with visible objects in html.. The variable is sent by GET anyway..

Do you guys have a hint for me?

Regards
Tore


#2 myophp

myophp
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 14 August 2006 - 02:09 AM

to prevent it from being sent, try disabling the hidden field. ie:
<input type='hidden' DISABLED value='not used' name='unused' />





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users