the onclick of a table row is also working on a textfield inside that row? - zen-cart

On the categories page Where all the products are listed in rows and each complete row is a link to that product details page.
In that row I have created a textfield and a submit button but the product details link is also working on the textfield which I does not want.
When I click in the textfield for writing something in it, it redirects me to the product details page and I am unable to write something in the textfield.
So How will I handle it so that I could write some value in textfield?

This is just because of zen cart default code to redirecting user in case of clicking product row.
yo can change default behavior by two ways :
Use JavaScript/JQuery
you can use below code to prevent default action while someone click on textbox
<script>
$(".sortTextBox").click(function(event) {
event.preventDefault();
});
</script>
Manually change code in PHP file
you need to change product listing code in categories.php file located in admin folder of zencart.

Or, since you're changing the way the admin interface works, you could expand your changes to also remove the action that allows clicking on that table-row to be a quick access link to the details of that product (which is where editing of that product's information is normally handled).
For example, the onclick event in these code snippets would need to be removed:
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '\'">' . "\n";
and
echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link($type_handler , 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n";
And then you'd have to use the (e) edit button to gain access to the actual normal product edit screen, instead of the luxury of clicking anywhere on the row.

Related

can we add form on activeadmin index page in rails 4

I'm rendering a partial in my index page
index do
.
.
div id: "overlay-select-period" do
render partial: "select_period", locals: { period: GoalCalender.legend_name_year, record: UsersGoalCalender.new }
end
.
.
end
and in this partial (.html.erb) under app/views/admin/users_goal_calendars, I'm having rails form helper form_for used
but when I run the app, it doesn't show the form tag on the view <form></form>
can anyone tell me whether we can add such form in activeadmin index page?
P.S. I've tried all other ways to add form (formtastic, simple form
and form_tag), and writing the form directly inside index do...end
(without rendering a partial) with no luck
I know this is an old question but I just discovered myself that AA somehow removes your form tag if batch actions are enabled.
This is because enabling batch actions wraps most of the page in a form and nested forms are not fun.
The mention something about it here if you scroll all the down: https://activeadmin.info/9-batch-actions.html
I tried disabling batch actions and the form tag comes back.

sugarcrm - add scheduler div to existing content when clicked on "schedule meeting" under activities subpanel of leads module

In leads detail view under Activities subpanel, when clicked on "schedule meeting" I get some fields to schedule a meeting. I found these fields are coming from
mysugar\modules\Meetings\metadata\quickcreatedefs.php
But in addition to these fields I need scheduler div to be placed right below these fields so that while scheduling a meeting we can see what all times are occupied. I found that the code to this is in
mysugar\modules\Meetings\tpls\footer.tpl
How to add the above tpl to quickcreatedefs.php? It contains all arrays.
I am seeing this scheduler div when clicked on "Full Form" button. But that redirects to other page. I just want to put this same scheduler div(graph that shows what all times are occupied) while scheduling quick meeting itself.
Thanks in Advance.
In the view defs in custom/modules/{modulename}/metadata you can define a footer tpl like this:
$viewdefs ['Meetings'] = array (
'QuickCreate' =>
array (
'templateMeta' => array (
'form' => array (
.
.
.
.
'footerTpl' => 'modules/Meetings/tpls/footer.tpl',
.
.
.
you just have to ensure that the used smarty variables for the footer tpl are set

Joomla Form Field User Front End

I am trying to use JFormFieldUser::getInput as an input to my Joomla forms.
In the backend (logged in with the super user), when I call this method, it produces a nice 'select user' box when clicked displays a list of all users to chose from.
I have been trying to use the User form field on a front end form (logged in with the super user). The result is some what confusing and undesirable. A 'select user' link is produced, but when clicking on it, the result is that the super users, 'User profile' is loaded up: not a list of all users.
Why is this, and how can i make 'select user' show the full list of users like it does in the backend.
Joomla 3 (from your field definitions):
<field name="field_name" type="sql" label="COM_FIELD_LABEL"
sql_select="id,name"
sql_from="#__users"
value_field="name"
key_field="id"
description=""
header="DROP_DOWN_HEADER"
required="false" />
Apparently it can't be done
The JForm (Joomla) User field is the Joomla core field that you can
see in Joomla article form to select a user (lightbox with list of
user). Becareful this field can not be used on front-end because
Joomla core don't manage it on front-end... Often we replace this
field on front end with a select dynamic field.
I didn't have much luck with this. Instead I created my own component and added in the content from com_users. Worked a treat.
Can be done fairly simply but with some significant limitations - depending on your use case.
User must be logged in to backend (even if you are trying to access the information frontend). If they are not logged in, it will prompt for log in and break out of the modal :(
User must have permissions for User Manager
Then duplicate the \libraries\cms\form\field\user.php to a fields location of your choice (in a modal subdirectory) and rename it to something like user2.php. Make the class name JFormFieldModal_Users2 and the $type='Modal_Users2'.
Don't forget to add the new path to your form .xml if required. The type will be "modal_users2".
Last step. In user2.php, change:
$link = 'index.php?option=com_users&view=users&layout=modal&tmpl=component&field=' . $this->id
. (isset($groups) ? ('&groups=' . base64_encode(json_encode($groups))) : '')
. (isset($excluded) ? ('&excluded=' . base64_encode(json_encode($excluded))) : '');
to
$link = 'administrator/index.php?option=com_users&view=users&layout=modal&tmpl=component&field=' . $this->id
. (isset($groups) ? ('&groups=' . base64_encode(json_encode($groups))) : '')
. (isset($excluded) ? ('&excluded=' . base64_encode(json_encode($excluded))) : '');
A bit hacky, but served my purposes.
Less hacky, but less glamorous solution here: The SQL formfield type

Zend Framework multiplay forms

I want get the follow thing working.
I've a page with a couple of text articles, each article has his own 'id' in the database. Below every article I want to make it possible to discuss about it. So I setup a discuss form witch I print with my article trough a 'foreach'.
In the form I added a Zend_Form_Element_Hidden. In the view I want to set the value of the hidden field with 'article_id', this likes me the best way to put it in the database?
In the foreach I try the follow thing but when I do this, the form is gone and I only get the element where I add the value.
My code in the view:
foreach ($this->paginator as $article):
echo $this->form->getElement('article')->setValue($article['id']);
endforeach;
I hope some one can make this a bit more clear for me :)
With kind regards,
Nicky
I am guessing you want to print the form inside the loop but only the element is being printed.
If that is your problem, the reason is because setValue() returns the element and not the form.
// Your Code
// This will only print the element and not the entire form
echo $this->form->getElement('article')->setValue($article['id']);
You will have to change your code to:
// Set the element value first
$this->form->getElement('article')->setValue($article['id']);
// Then render the form
echo $this->form;

Conditional Ajax.Actionlink in Telerik MVC Grid

I have a Telerik ASP.NET MVC 2.0 Grid on a partialview . Here in this Grid there is column say " Status" having values as " active " & " inactive". I want to show a delete link in only those rows having Status Column Value as " Active ".
I am rendering this partialview on my main View having a ViewModel and my partialview is rendered using a descriptor .
I tried to use a ClientTemplate / Template but I am not able to put a condtional check before displaying a delete Link . How to achieve this using C# 4.0 ASP.NET4.0 code . I need some sample code . Its very urgent so your help is deeply appreciated .Thanks in advance for going through my problem
Basically, you will most likely need to wrap a conditional block inside the template definition which to determine whether the delete link should be output or not. Check the general templates definitions from the demos below and try this out to see how it goes:
http://demos.telerik.com/aspnet-mvc/razor/grid/templatesclientside
http://demos.telerik.com/aspnet-mvc/razor/grid/templatesserverside