Link to home
Start Free TrialLog in
Avatar of Misty Corning
Misty Corning

asked on

Form submission

Could I please get help with this?  I've used input buttons on this.  Is this correct?  If so, how do I connect the buttons to the submit button?  Thank you!
scan10132017160616--1-.pdf
Avatar of Rayaan Wasty
Rayaan Wasty
Flag of United Kingdom of Great Britain and Northern Ireland image

A simple example will be :

<form action="http://google.com">
    <input type="submit" value="Go to Google" />
</form>

here you can pass variables via the url aswell. Hope this helps.
If you are asking how to pass values of the group of button selection then that could be achieved via Javascipt by setting the value of each variable on each click and then passing by submit button.
Avatar of Julian Hansen
I've used input buttons on this.
Depends what type of input buttons.

The form contains options which are more conducive to radio inputs
<input type="radio" name="gender" value="Male"> Male
<input type="radio" name="gender" value="female"> Female

Open in new window

As for connecting the buttons to the submit button - this question does not really make sense in the context of the form.

Form values are passed to the server using the name you give to the control - in the above example the field "gender" will be posted to the server with the value of the selected radio button (assuming one was selected);

All controls are grouped inside a <form> element. When a submit button (there can be more than one) is clicked all the form controls that have names (this is important - no name - no submit to server) are sent the server as key value pairs
For example
id=1&name=John&gender=Male

Open in new window

Avatar of Misty Corning
Misty Corning

ASKER

Ok, they are radio buttons.  I've put them as <input type="button"> hmm  Is there a way to make the radio buttons look like the fields in the file?  How do I style this?  

And what I meant by "connecting": when a user clicks on a button in each field, they need to be able to submit the highlighted buttons.  I hope this is making sense.  That's why I was putting them in a form.  Thank you for your help!
You are on the right track. A form is used to contain controls whose values we want to bundle up and send to the server.

As for radio buttons we set them up like this
<input type="radio" name="gender" value="male"> 

Open in new window

Note the type = radio. For radio buttons it is important to keep the name the same for all radio buttons in the group
AND don't forget to give them a value attribute. If you don't do the last bit the server won't know which button you clicked.

As to styling - radio buttons are a bit rigid with respect to styling options - however we can fudge it by hiding the radio button and instead style a label that is linked to that radio button so that when the label is clicked it "clicks" the radio button for us.

This PAQ (previously asked question) discusses how to do this
https://www.experts-exchange.com/questions/29066554/How-to-use-image-as-value-for-radio-button.html?anchorAnswerId=42355323#a42355323

And this sample shows how its down
http://www.marcorpsa.com/ee/t2780.html

Start there and post back if you need to ask more questions.
Sorry, the link didn't work.
Sorry - long day used the wrong URL please try again.
http://www.marcorpsa.com/ee/t2780.html
Sorry about that!  :)  How do I cover up the radio buttons with just text?  Thanks.
In that sample remove the class="icon" from the <label> and put the text inside the label like this
  <input name="gender" id="male" value="male" type="radio">
  <label for="male">Male</label>
  <input name="gender" id="female" value="female" type="radio">
  <label for="female">female</label>

Open in new window

BUT You will still need some way to indicate which one is selected - how do you want to do that with text?

I am also assuming that we are continuing on the track that you don't want to use the standard radio button which displays a circle next to which you place your text i.e. like this
User generated image
How do we indicate which one is selected?  I would like to have the button clicked and highlighted.  

the 'gender' and 'race', 'location of stop' only one.  On 'reason for stop', 'search', 'description of contraband', and 'arrest', and 'force used' there can be multiple reasons.

And yes, that is correct (have only texts displayed if possible).

Hope this helps
ok, I have the visual part just about complete.  How do I indicate which one to select??
How do I indicate which one to select??
How do you want to indicate it?

You can use buttons instead of text and give them a background colour.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.