Forums

validate text field based on radio field

gbarone 26 Oct, 2011
hallo,
I'm using cf v4 on joomla 1.5.2x, I think you did really a great component.
I need to setup a custom validation, the way as the post title tells:
if I check a radio, consequent input text field should be required.
I tried to do something with js client validation. so:
On load event of the form
- load js with:

function checkpwork(el) {
    if (el.value == 'online') {
        formCheck.register($('prof_work_link'));        
    }
}

and in the form, have a radio box like this:

          <input type="hidden" name="work_submission" value="" alt="ghost" />
          <input type="radio" name="work_submission" id="work_submission_online" title="" value="online" class="validate['%checkpwork']">
         
          <input type="radio" name="work_submission" id="work_submission_per_regular_email" title="" value="per regular mail" >
(some more html stuff, then:)
          <input id="prof_work_link" maxlength="255" size="60" class="" title="" hide_label="0" type="text" value="" name="prof_work_link" />


I get no results. I could even use server side validation instead of this logic, but event this solutiond does not seem to work.
Moreover, I don't know what should happen using client side custom validation: this way should I have error onBlur? onSubmit?

ps: I'm using js client validation for the rest of the fields (that I did not paste in this post), and it works as expected. I am not new to chronoform, but really cannot get to fix this. thanks.
gbarone 02 Nov, 2011
please forget this post. I wrongly used "custom code" to put validation inside the form workflow.
I just discovered "custom server side validation", that does exactly what I need.
thanks anyway.
This topic is locked and no more replies can be posted.