Show/hide element with javascript

Status
Not open for further replies.

madpato

Member
Hello

I am trying to do a rather simple javascript function with the predefined action, you can see on the screenshot attached what i am trying to achieve, its pretty simple, when the current field has a certain option, the other element must hide from the form, i need to do this also with groups and forms, so if i manage to make this work i can do a lot.
BTW the element emp_proyecto is a databasejoin and the element tns_emprendedores.fecha_const_legal is a date field.
Thanks for your time.
 

Attachments

  • Capture.PNG
    Capture.PNG
    5.9 KB · Views: 556
Hi As you effect is looking at a database join element the javascript's event's 'value' you should be comparing against needs to be equivalent to the database join's 'value' (and not its 'label').
So, your database join element is created in the form as:

HTML:
<select id="tns_emprendedores___emp_proyecto" name="tns_emprendedores___emp_proyecto[]" class="fabrikinput inputbox input input-large" size="1">
<option value="Seleccione">Seleccione</option>
<option value="1">Emerge</option>
<option value="2">Potencia Patagonia</option>
</select>

What you should compare against is the "1" in <option value="1"> and not 'Emerge' which is the label.

As its an exact comparison you can also replace the javascript events 'contains' condition with '=='

hope that helps!
Rob[/html]
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top