This topic is locked

Conditionnal fields

10/23/2010 3:55:13 PM
PHPRunner General questions
P
piobote author

Dear all,
My table has 5 field:

  • Name - Text field
  • Town - Text field
  • Status - Radio button (values = employee and student)
  • Company - Text field
  • University - Text field
    On my Add form I would like to get this:
    a) if Status = employee then I will need to fill only Name, Town and Company on the add form
    <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15566&image=1&table=forumtopics' class='bbc_emoticon' alt='B)' /> if Status = student then I will need to fill only Name, Town and University on the add form
    Please help me
    Thanks
    Pedro

M
macskafogo 10/23/2010



Dear all,
My table has 5 field:

  • Name - Text field
  • Town - Text field
  • Status - Radio button (values = employee and student)
  • Company - Text field
  • University - Text field
    On my Add form I would like to get this:
    a) if Status = employee then I will need to fill only Name, Town and Company on the add form
    <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=53841&image=1&table=forumreplies' class='bbc_emoticon' alt='B)' /> if Status = student then I will need to fill only Name, Town and University on the add form
    Please help me
    Thanks
    Pedro


var ctrlSTATUS = Runner.getControl(pageid, 'STATUS');
ctrlSTATUS.on('change', function(e){

if (this.getValue()== "employee") {

document.getElementById("university").style.display="none";

}else{

document.getElementById("university").style.display="table-row";

}});

R
Renex 10/26/2010

I have used this piece of code, it works well, but when I use the script two times, it goes wrong.
My code:

var ctrlComputer = Runner.getControl(pageid, 'Computer');

document.getElementById("hidediv1").style.display="none";
ctrlComputer.on('change', function(e){

if (this.getValue()== "Nee") {

document.getElementById("hidediv1").style.display="none";

}else{

document.getElementById("hidediv1").style.display="table-row";

}});
var ctrlComputer_type = Runner.getControl(pageid, 'Computer_type');

document.getElementById("hidediv2").style.display="none";
ctrlComputer_type.on('change', function(e){

if (this.getValue()== "Laptop") {

document.getElementById("hidediv2").style.display="none";

}else{

document.getElementById("hidediv2").style.display="table-row";

}});


So when the field 'Computer' gets value 'Ja' computer_type(hidediv1) shows. When computer_type gets value 'Laptop', Dongle (hidediv2) shows up. But it does not work..
Any idea?

A
ann 10/26/2010

Hi,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. 'Demo Account' button can be found on the last screen in the program.