/    Sign up×
Community /Pin to ProfileBookmark

how to change the value of textbox with dropdown?

i got this code on file.php

[code=php]
$PercentSelect = ‘<tr><td class=”grey” align=”left”>’.translation(‘INPUT_TYPE’,$language_code, $connection).’:</td><td class=”grey” align=”left” width=70%>’;
$PercentSelect .= ‘<select name=”Percent” onChange=setValues2(‘1′);setFromPercent(”.$Percent.”);submit()>’;

if ($Percent == ‘MONEY’){
if($action2 == 1){
$fill=($yearly_budget/$last_periods_selected);
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.$fill.'”>’.$unit.”.$errorvalue.”;
}
else{
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.$fill.'”>’.$unit.”.$errorvalue.”;
}
}
if ($Percent == ‘AUTOMATIC’){
if($action2 == 1){
$fill=(100/$last_periods_selected);
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.substr($fill,0,4).'”>%’;
}
else{
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.$fill.'”>’.$unit.”.$errorvalue.”;
}
}
if ($Percent == ‘PERCENT’){
if($action2 == 1){
$fill=(100/$last_periods_selected);
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.substr($fill,0,4).'”>%’;
}
else{
$data = ‘<input type=”text” maxlength=”255″ name=”‘.$name.$i.'” size=”‘.$size.'” value=”‘.$fill.'”>’.$unit.”.$errorvalue.”;
}
}

$save_button = “<input type=”submit” name=”knop” value=”save” onClick=”setValues( ‘1’ );” class=”formbutton”>”;
[/code]

it will display some textbox and the value is $fill
if i dont change the dropdown (from percent to money or vice versa) the $action2 == 0

if i press the save button (with changing the dropdown), it’ll automatically fill in the text box with $fill value
but if i press the 2nd time (without changing the dropdown), how to make the text box still have the $fill value?

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @cmon1011 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...