Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML tag not working well

Status
Not open for further replies.

speedyrudolf

Programmer
Sep 2, 2009
27
RO
Hi. I'm trying to make a form with some hidden fields (when the user clicks a button a new field appears). Anyway...after every field+button (they go together on a single line) I put the <br/> tag (otherwise it would be very confusing, with a field, button, field on a line, on the next line a button, field, button, field etc). But now there is a big gap where all the (invisible) fields are.
I can't upload the screenshot, so...anyway, I think you can understand the problem from the description.
Any help is very much appreciated. Thanks.

 
Don't use BRs... instead put the inputs in a DIV and give it a bottom margin.

Then, instead of hiding & showing the fields + button, hide / show the DIVs instead.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
I thought of that, but the form is quiet long (about 6 pages) and I'm already using divs to divide it and show a "page" at a time...to use divs for these inputs would complicate things too much.
 
Perhaps you should farm this off to a coder who can deal with nested DIV elements, rather than calling a bog-standard solution 'complicated'?




Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Instead of hiding them, set the display to none. That will make them not take up any space so you'll get no gab.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
yeah...I know it's standard...but, like I already said, the form is quiet big...I mean, the file already has about 40kb, it has about 23-25 javascript functions, and well over 60 divs...so...yeah...I'd call that a bit complicated... :D
 
oh...I forgot to reply to the last post...the display property is already set to none...if I would "hide" them, the gap would be even bigger (don't know why)...

but is there no substitute for <br/>??
 
If you have all those <br>s, they're not going to be hidden. That's probably what's causing the big space. If you do like Dan said, use <div>s and set the display to none on THOSE, I'd guess that it will get rid of the big gap.

Now, you've gotten the same answer from 3 different regulars at Tek-Tips.

Lee
 
Set the display:none for the <br>'s too.

Otherwise they generate the empty space.






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Phil, then he'll have to display each <br> again as the form progresses. Using <div>s with display:none would take care of everything in a simpler fashion in the long run.

Lee
 
True, but since he is already changing display of things, adding one more line to it (I'm assuming he's doing this with Javascript) is not too much harder.

Though he would have to name the <br>s the same for this to work most simply.

Using DIV's would mean adding a div for each input he wants to hide, as it seems he's not just un-hiding complete sections but rather input by input.

There are many ways to do this, however they seem to all involve display:none on some element.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Using DIV's would mean adding a div for each input he wants to hide

Yes, although, let's face it, to do so is hardly a burden. I'm not sure I understand the reluctance to do this.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Yes, although, let's face it, to do so is hardly a burden. I'm not sure I understand the reluctance to do this.

Agreed





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top