Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6947715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:43:43+00:00 2026-05-27T13:43:43+00:00

I have a form that im working on, im trying to reset a field

  • 0

I have a form that im working on, im trying to reset a field when the no value is selected from the dropdown.
My form layout is as follows:
[Dropdown – name : gasoiluser – values = yes/no] [Text form field, name = gasoilmargin]

So someone comes along and selects yes from the drop down, enters a value into the text box and hits submit. If they then come back later and set the gasoiluser dropdown to no and hit submit the value in the text box stays, what I would like is when no is selected on the dropdown the form resets the value of the text field to 0.00.

I have tried doing this with php without much success, so I am not sure if there is a easier more elegant solution with javascript ?.

Thanks 🙂

The code I have tried is :

<?php
$query = mysql_query("SELECT * FROM hqfjt_chronoforms_data_dashboard WHERE cf_id = '1'") or die(mysql_error());
$oilprice = mysql_fetch_object($query);

$oilpricederv = $oilprice->oilpricederv;

$dervmargin = $form->data['dervmargin'];
$dervuser = $form->data['dervuser'];

if ($dervuser=="" or $dervuser=="no")
  $calculateddervprice = '0.00';
else
  $calculateddervprice = $dervmargin + $oilpricederv;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:43:44+00:00Added an answer on May 27, 2026 at 1:43 pm

    Here is the javascript version.

    But make sure to dbl check that with php incase the browser messes up. here is a sample php code:

    $dropMenu = $_POST["gasoiluser"];
    $textBox = (($dropMenu == "no")?"0.00":$_POST["gasoilmargin"]);
    // Do stuff w/ variables here (like mysql)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user form that is working perfectly. The page makes use of
I have a form that i am trying to submit after the page loads
I'm trying to use form validation that is working in this example with my
I have a form that is showing a MessageBox using MessageBox.Show, and trying to
Here is what I am trying to accomplish. I have a form that uses
I have a working Action and JSP form that I'm using for creating new
I have a form layout that I want to display the label aligned left
I have an existing site that is working well with Authlogic login. I'm trying
I have a web form that is using this awesome plugin and I'm trying
I currently have form that checks if a user has unsubmitted changes when they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.