how can i show/hide fields in the edit profile view, based on a value stored in the registration; it seems the rules that i have in a hidden filed are not quite working
can i make a hidden field that reads the stored value from the db and based on that autopopulates the form? i what kind of workaround do you use for this kind of behavior?
Hi,
you can use a simple workaround that do this without hack: you can simply fill value with javascript.
for example you can add something like this in your template (index.php)
<?php
// PHP CODE TO FILL VAR $your_value FROM DB
?>
jQuery(document).ready(function($){
$('#jform_aliasOfHiddenField').val('<?php echo $your_value; ?>').change();
});
NOTE: when you fill the value you need also to launch .change(), this trigger change events and apply conditions to hide/show fields
this is a hidden field, so the user never change value, you will change value from db lookup and already trigger change event.
In my code below you change value and launch change event.
There are no replies made for this post yet. However, you are not allowed to reply to this post.
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »