Is it possible for a link to be grouped in with two radio buttons using fieldset

I want a link to be grouped in with two radio buttons using fieldset There is no name Attribute for a href link
This is what I have so far:

<div class="fieldset-auto-width">
<fieldset id="group1">
<div class="tc tc7">
<span class="button">
<a href="called_form.php?var=XXXXX&var2=XXXX" target="_blank"></a>
</span></div>
<div class="tc tc8">
<input type="radio" name="group1" value="a"/></div>
<div class="tc8a">
<input type="radio" name="group1" value="d"/></div>
</fieldset> <!-- end fieldset id -->
</div> <!-- end fieldset-auto-width -->

Thank You

Can you explain this a bit further? I don’t understand what you are trying to do.
It looks like you are trying to use an <a> to submit the form, rather than a submit input, why is that?

I don’t want to use a submit button here. I want to give the user the option to call another form passing variables or clicking one of two radio buttons. This is a mutli row form and I want the user to stay on the first form. if the user clicks on button with the link certain database information will be passed two the second form. The user will work with that form and that form will have a submit button. The user will close out that form and continue with the first form. When the user has completed working with the first form that is when they will hit the submit button

I don’t quite understand what your problem is. It looks like you have already enclosed the three items in a fieldset. As far as I know, a fieldset has no functionality other than to group items together within a form. I don’t think they have to all be form elements.

You need to assign a name Attribute to the fieldset look at the

<fieldset id="group1">
<input type="radio" name="group1" value="a"/></div>
<input type="radio" name="group1" value="d"/></div>

a href does not have “name” to assign group1 too

Could you not use an actual <button> element, rather than a span (which looks as if you intend to style it as a button)?

If i did that it would show up like a link. I don’t want that

The href attribute of an anchor element and the anchor element itself are not form elements. I believe what you should be using is a submit input to submit the form data, that being the purpose of that input type. Possibly in its own form, rather than within a fieldset.

Could you please give and example?

It will depend on where this sits within the rest of the form. A form within a form is invalid html. So if it’s at the beginning or end of the parent form, that’s easier, just keep it on the outside.
If it’s somewhere in the middle it could be trickier, you can link inputs to a form that they are not descendants of using the form attribute to reference a form’s id. I’m not sure if it’s OK for those inputs to be inside another form, if not, you may need all inputs to be external to the forms and reference them by the form attribute. Though I’ve never actually had need to use nested or multiple forms on a page, I prefer to keep forms simple and uncomplicated, avoiding this kind of thing.

I have it working now. Here is the code. This is what I was looking for
This will work on a multi row form

<div class="tc tc7">
   <span class="button">
      <a href="called_form.php?var=jerome&var2=greene" target="_blank"></a>
   </span></div>

<div class="fieldset-auto-width">
    <fieldset id="group1">
       <div class="tc tc8">
          <input type="radio" name="group1" value="a"/></div>
        <div class="tc8a">
           <input type="radio" name="group1" value="d"/></div>
      </fieldset> <!-- end fieldset id -->
 </div> <!-- end fieldset-auto-width -->

It’s not what you said you were looking for.

I’m pleased you’ve found a solution with which you’re happy (and that you’ve posted it here), but for future reference, remember that the clearer you can be about your actual requirements, the more likely it will be that somebody can offer an appropriate solution.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.