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 9046643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:42:13+00:00 2026-06-16T11:42:13+00:00

I have some codes to combine several fields and pass to 1 input field

  • 0

I have some codes to combine several fields and pass to 1 input field F on user’s profile page. After loading, #Salary_para1 will pass value to field F first, then when user enter value in #Salary_value, it will pass its value to field F too. Same condition with checkbox #Salary_para2.

There is problem after user save their profile page. Let say, field F have value “MYR1000 + Allowance” after saved. After loading, field F still shown value of #Salary_para1 (‘MYR’ in sample) instead of “MYR1000 + Allowance”.

1) How to make sure that field F shown “MYR1000 + Allowance” after loading??
2) How to make it don’t pass value of #Salary_para1 (MYR) if user didn’t input value to #Salary_value?
3) How to make sure that if field F after loading have value of “MYR” and “+ Allowance”, then field #Salary_para1 will show ‘MYR’ and checkbox #Salary_para2 will be checked? (revert back)

http://jsfiddle.net/e2ScF/69/

CODE:

<select id="Salary_para1">
  <option value="">Choose...</option>
  <option value="0" selected>MYR</option>
  <option value="1" >SGD</option>
</select>
<input id="Salary_value" type="text"/>
 + <input type="checkbox" id="Salary_para2" name="Salary_para2" value=" + Allowance"  />Allowance<br/>
<input type="text" id="targetTextField" name="targetTextField" size="31" tabindex="0" maxlength="99" value="MYR1000 + Allowance">

$(function() {
setTarget();
$("#Salary_para1,#Salary_para2").change(setTarget);
$("#Salary_value").keyup(setTarget);

function setTarget() {
    var tmp = $("option:selected", "#Salary_para1").text();
    tmp += $("#Salary_value").val();
    tmp += $("#Salary_para2:checked").val() || '';
    $('#targetTextField').val(tmp);
}
});
  • 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-06-16T11:42:14+00:00Added an answer on June 16, 2026 at 11:42 am

    1) is possible only if your are saving the F field somewhere.. since it is not possible to get
    a javascript var after reload

    2) check for condition if empty or not and do your stuff there

    3)revertback is possible.. considering you have the F field var saved somewhere…load the var.. split it into arras and check for condition..

    check this fiddle..

    http://jsfiddle.net/e2ScF/75/

    and fiddle with other example..

    http://jsfiddle.net/e2ScF/74/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some codes like this: cats = Category.objects.filter(is_featured=True) for cat in cats: entries
I have some codes read the query results from sqlite: while (sqlite3_step(statement) == SQLITE_ROW)
I have some codes as below #import <UIKit/UIKit.h> @interface ViewMoreSettingController : UIViewController < UITableViewDelegate,
I have some codes like this: PrintWriter pw = new PrintWriter(new BufferedReader(....)); for(int i=0;
I have some source codes to display all file names in a UITablView I
I have some old fortran77 codes, and I convert them into .pyd files using
I have found some jQuery codes for show content with slide effect, but none
I have some C# code that generates google maps. This codes looks at all
In my C++ application, I have some values that act as codes to represent
I have a table rel with fields id refid cellid cat and some working

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.