Show/Hide columns in Edit/Add dialogue based on dropdown

QuestionsShow/Hide columns in Edit/Add dialogue based on dropdown
edwardw asked 11 years ago

Hi Abu
I've looked through the documentation and support but wasn't able to find a solution. I would like to show or hide certain columns in the ADD/EDIT dialogue boxes based on the user's selection in a dropdownon the dialogue. Is this possible? Also if the user chooses a dropdown value I'd like to pre-populate certain values based upon the selection. So I'm wondering how much can the dialogue be modified once it is already opened.

Thanks

4 Answers
Abu Ghufran answered 11 years ago

Hello,

All you need is to connect onchange event with dropdown, and do your changes using jquery.
e.g.

$col["editoptions"] = array("onchange" => "change_form(this)");

and in html ..

<script>
function change_form(o)
{
if (o.value == 'blabla')
{ … }
}
</script>

now this "…" could be your ajax call to load data and fill json output using jquery.
this could be jQuery("#tr_gender").hide() or .show()

Hope this would give you an idea.

Abu Ghufran answered 11 years ago

Forgot to mention, you can inspect the textbox OR the <TR> table row id using firebug for change.

Abu Ghufran answered 8 years ago

Hello Stephan,

I've emailed you one solution, another is to set:

$col["hidden"] = true;
$col["show"]["add"] = true;
$col["show"]["edit"] = true;

Stephen Hartigan answered 8 years ago

Hi Abu,

Hide function works fine for me, but how do I set a column to be initially hidden in the form view so that I can use show based on value change in another column?

Thanks, Stephen

Your Answer

6 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?