I have a three CCK fields: Quantity, Price and Total. I would like to compute Total as a Price * Quantity. Is there any way to achieve this when the user keys in the Price or Quantity the total should be calculated automatically. I also looked upon the computed field module but this works only when I have Price and Quantity and submit the form. I also don't have an idea of applying jQuery inside CCK fields in Drupal.
Automatic calculation in a Drupal CCK field
1k Views Asked by Mohan Timilsina At
2
There are 2 best solutions below
0
BigEd
On
Also there is an alternative to Computed field module for D7.
Math expression fields are dynamically updated via ajax on the entity form as soon as all necessary fields are populated. If JavaScript is disabled, the field will be evaluated when the form is submitted. The result is stored in the database when the form is submitted.
Related Questions in DRUPAL
- Drupal image styles DivisionByZeroError
- Drupal: MQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user when accessing any page with a form
- How can I add taxonomy to uploaded files through an api in Drupal 10
- How to retrieve taxonomy term name in url instead of id in a drupal view?
- Save button not displaying in drupal 9
- how to do ajax callback in custom block, which will fetch records from database dynamically in Drupal 10?
- Why are my form fields, built using Drupal Next.js Webforms, not displaying the Help Text?
- Multiple replacement / substitute NGgram string SOLR 8.6
- Drupal 9 Bartik (default theme) carried over from old Drupal seems to have previously worked but no longer renders HTML properly
- Getting no State error with simplesamlphp library v 2.13
- Using the Drupal Cache API for Drupal Entity Caching
- drupal version issue drupal 8 to drupal 10
- Why does my pure CSS parallax scrolling stop working on completion of page loading in Drupal 9
- Getting the value from a multi-select list PHP in Drupal site
- Parent menu link opens children when clicked, instead of going to link (Drupal)
Related Questions in FIELD
- Problem with sample code to set font properties for a whole XWPF Paragraph that includes Word fields
- After using PDFRW in Python to update fields - triggering an update?
- Insert a custom button after WooCommerce Checkout Billing Address Field
- Acrobat Javascript If Else to calculate on change in validate area
- ncurses - form field validation - can't modify "TYPE-INTEGER" value entered and outside range specified with set_field_type()
- `Pydantic` `self.model_dump()` doesn't pick up subclass instances passed to a field
- How to remove or disable form field shading in Spire.Doc for Word documents?
- Save custom checkout field from shortcode in WooCommerce
- Why doesn't Visual Studio display reference shortcut links for fields?
- Anyone able to provide a function.php snippet for Woocommerce Product field hooks in order to relocate an image swatch?
- Forwarding ref parameters through a ref struct with "unsafe" ref punning - is this safe?
- Text* Validation - Contact Form 7
- How to modify property values through reflection
- MapStruct maps the model's field as empty when the field is of an abstract type
- im working with react admin . Reference fields fetched data would display for a few moments and then disappeared
Related Questions in CCK
- Drupal 8 - Allow Insert Media icon to select existing images using CCK Editor
- Seblod Site form not saving to backend
- Joomla, Zoo, Category renderer
- Editing the computed field function code
- Drupal 7: How do I change the input format of a Date after the field was created?
- Joomla 3 and YooTheme Zoo - Use Category Teaser Image For Item Teaser Image
- How do I use a Taxonomy in a CCK created field?
- Programmatically update CCK List allowed values on an ajax callback attached to a dependent field
- How to show comments for an unpublished node
- How to invoke hook_node_submit for custom content type
- Requesting rollback of field "field_images" due to failure to convert record:
- drupal 7 : Undefined index: text_processing in text_content_migrate_instance_alter()
- Joomla CCK Seblod: Adding a Media field with 'alt' and 'title' attribute
- Can't see custom CCK field in view
- How to give edit permission only to specific fields in node edit in?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Use the Computed field module for this.
Although it won't show the value on the node edit form, it will be automatically calculated and can be displayed in a view or in the node display.
Is there a particualr reason you want the total to be displayed on the node edit form? You can add some jQuery to automatically do this but you run the risk of the user changing this field or having JS disabled.