Hello. This is my first post! Little basic first: I am very new in the web-business, having taken a few courses and being mildly interested in it for the past couple of years - I recently got a job that requires me to do things I don't neccessarily know from before (Dont' we all?). I know basic HTML, CSS and some ASP. Even a little ActionScript!
So now, I have been asked to add some requirement-functions to a pretty simple HTML form. I cannot link you to the site as it's classified, but I can try to explain what I need.
I was told this would be "easy" to do in javascript or jquery, but I am clueless so I came here. Please point me in the right direction
I have a form, and 2 of the sections are as following:
1:
Checkbox 1, Checkbox 2, Checkbox 3, Checkbox 4, Text input
Where the customer picks either one of the checkboxes, or multiple - but if none are selected, the text input box has to be required.
2:
Radio 1 (yes), Radio 2 (no), Text input(if yes, describe)
So Radio 1 or 2 has to be requried, AND if radio 1 (yes) is selected the text input box also has to be required.
There is one more thing though, you specify the functions to the input name. The input names I already have are all different. So I wonder, can I change then without that screwing up the sending of data at submit? Or is it the input ID that does this.
If it is the name, then would there be a way to edit the script to allow the same function for names four1, four2, four3, four4 and five1, five2?
Hope you understand what I mean, hard to explain when i'm not a pro with the terminology.
Apologies if it's just me being stupid for not understanding,
but when you helped me with the original script, there's only "four" defined for checkboxes and "fourtext" for the text (same goes for five)
Wouldn't there have to be something more in the script when the checkboxes in four have different names/ID's from eachother (as in first checkbox is four1, second checkbox is four2 etc.)
Any chance you can help me with the script as this is hard to understand when I don't know the language
Reviving this as I need some more help with this! Thanks a bunch for the previous assistance btw, works great. You'd think I might learn something from it but I barely understand the code to adapt it into what I am going to ask next:
I have to add something to this page/form. It's basicly a yes/no question but the answering has to be done by checkboxes, not radio buttons as I can't get that to work with writing the form data to PDF as radio, only as checkboxes. So to check one has to be required!
So,
Code:
<label>Do you agree to some marketing thing bla bla bla</label>
<input value="yes" type="checkbox" name="marketing_yes" id="marketing_yes" />
<label for="marketing_yes">Yes</label>
<input value="no" type="checkbox" name="marketing_no" id="marketing_no" />
<label for="marketing_no">No</label>
It's basicly a yes/no question but the answering has to be done by checkboxes, not radio buttons as I can't get that to work with writing the form data to PDF as radio, only as checkboxes.
I think this is the real problem you need to resolve (i.e. why won't it work using radio) instead of forcing to use checkboxes as radio buttons (which is not their purpose).
It would be nice if you can describe the process of "writing the form data to PDF" that you are using, and getting help with getting radios to work from there.
I think this is the real problem you need to resolve (i.e. why won't it work using radio) instead of forcing to use checkboxes as radio buttons (which is not their purpose).
It would be nice if you can describe the process of "writing the form data to PDF" that you are using, and getting help with getting radios to work from there.
That process doesn't happen inhouse, so I don't know why it doesn't work actually. I am just filling in this position for a year (and I lack so much knowledge, lucky I even got the job lol) and those are the instructions I got from the person I am filling in for. Radio buttons won't work, that's all I know. I could try to prove them otherwise but I wouldn't even know where to start! Whenever the code has to be updated it is to be mailed to some guy at some company who does most of the back-end stuff for this site, i.e. making the information in these forms into a PDF document.
Originally Posted by refreezed
Here's something very simple that'll make the checkboxes act like radio buttons:
Code:
some pro code
Even for a beginner I think this is pretty easy to understand so I won't bother explaining more.
Thank you sir, that worked perfectly! Now all I need is to make that required as well, in the same style as the rest of the form (see above posts in this thread) Anyone?
Bookmarks