Jump to content

Archived

This topic is now archived and is closed to further replies.

woodhacker98

Hide and show different hidden fields with javascript.

Recommended Posts

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:

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

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

Share this post


Link to post
Share on other sites
to prevent it from being sent, try disabling the hidden field. ie: [code]<input type='hidden' DISABLED value='not used' name='unused' /> [/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.