I am currently running some javascript to validate that some fields have data in them before the submit button allows the user to proceed. I'm using javascript because I want a popup to tell the user what they are missing. The only bad thing is, my javascript isn't working for the checkbox (with 3 options). I think my main issue is I don't know exactly how to tell the javascript how to call that field name. Where is my javascript atm:
My form html code looks like this:
I've tried the following:
ChronoContact_service_request.service_request.value
ChronoContact_service_request.service_request[].value
ChronoContact_service_request.service_request1.value
None of these work. Any suggestions would be great. Thank you.
function chkForm()
{
if (ChronoContact_service_request.service_request.value == "")
{
alert("You must choose atleast one service request");
ChronoContact_service_request.service_request.value.focus();
return false;
}
}
My form html code looks like this:
<DIV class=float_left title="You must choose one"> <input value="I want you to help me lease my land!" title="You must choose one" class="radio validate-one-required" id="service_request0" name="service_request[]" type="checkbox" />
<label for="service_request0" class="check_label">I want you to help me lease my land!</LABEL><BR>
<input value="Make me an offer for ½ of my royalty interest" title="You must choose one" class="radio validate-one-required" id="service_request1" name="service_request[]" type="checkbox" />
<label for="service_request1" class="check_label">Make me an offer for ½ of my royalty interest</LABEL><BR>
<input value="I want to Ask a Landman the following question" title="You must choose one" class="radio validate-one-required" id="service_request2" name="service_request[]" type="checkbox" />
<label for="service_request2" class="check_label">I want to "Ask a Landman" the following question</LABEL>
I've tried the following:
ChronoContact_service_request.service_request.value
ChronoContact_service_request.service_request[].value
ChronoContact_service_request.service_request1.value
None of these work. Any suggestions would be great. Thank you.
Hi stirfry,
You need to define ChronoContact_service_request inside your Javascript. It will be something like
That said, why aren't you just using the built-in ChronoForms validation? The latest releases include this validation and will save you a lot of coding time.
Bob
You need to define ChronoContact_service_request inside your Javascript. It will be something like
var ChronoContact_service_request = document.ChronoContact_service_request;
That said, why aren't you just using the built-in ChronoForms validation? The latest releases include this validation and will save you a lot of coding time.
Bob
Well, the validation that comes with chronoforms would be just fine for me, but my client is not happy with the way it validates. My form is very long. It has 28 unique fields. The reason my client doesn't like the built in chronoforms validation is if you can not currently see the field that is required, when you hit the submit button, it doesn't make it very obvious that the form needs more input from the user. So, I got some javascript to make a popup that tells the user exactly which field it is that they needs to fill in to submit the form.
Now, in a perfect world, I would love to have some php code that I could put in the onsubmit portion of the "Form Code" tab in chronoforms. Unfortunately, I don't know php that well.
Ultimately, I need the form to make it VERY OBVIOUS that there is data that still needs to be filled in to submit the form. If you have any better suggestions, I'd love to hear them as this is creating alot of headaches for me!
BTW, I have Joomla 1.5.8 and Chronoforms v3.1 RC4.11
Thanks
Now, in a perfect world, I would love to have some php code that I could put in the onsubmit portion of the "Form Code" tab in chronoforms. Unfortunately, I don't know php that well.
Ultimately, I need the form to make it VERY OBVIOUS that there is data that still needs to be filled in to submit the form. If you have any better suggestions, I'd love to hear them as this is creating alot of headaches for me!
BTW, I have Joomla 1.5.8 and Chronoforms v3.1 RC4.11
Thanks
Hi stirfry23,
Ok - I understand that. It may be possible to change the alert type with LiveValidation but I don't know how.
Bob
Ok - I understand that. It may be possible to change the alert type with LiveValidation but I don't know how.
Bob
Hi stirfry23,
Ok - I understand that. It may be possible to change the alert type with LiveValidation but I don't know how.
Bob
Hi Bob, stirfry23,
I think that the validation JS file to collect the errors and show them in an alert box onsubmit, I may add this to the next version!🙂
Regards
Max
This topic is locked and no more replies can be posted.