/    Sign up×
Community /Pin to ProfileBookmark

Checking multiple form on one page

I have a page with several forms. Each one with a radio group with values ‘yes’ and ‘no’.

Only one form on the page can and must contain the value ‘yes’.

All forms have the same id and all radios have the same name.

Is this at all possible?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@__12510___12523___12467_Jun 30.2014 — This is not possible. IDs are UNIQUE.

If you make multiple forms, give them a unique ID each.

Control elements contained in a form can have a name which you already gave to another control element in another form since when you submit the form, only the values of the control elements inside that one form are sent to the server.

If you want to submit all forms at once, you will have to use JS. You could serialize the forms into JSON and then send the JSON to your back-end. Multiple control elements with the same name will still work.
×

Success!

Help @Axell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...