aika Posted June 24, 2009 Report Share Posted June 24, 2009 Kods kurš nestrādā pareizi: ... $birth_date .= "<option value=$i ".($i == $birth_year)?"SELECTED":""." >$i</option>"; ... jo attiecīgajā rindā atgriež selected="selected" Kā to uzrakstīt pareizi (vienā rindā)? Quote Link to comment Share on other sites More sharing options...
bubu Posted June 24, 2009 Report Share Posted June 24, 2009 Vai tik . operatoram nav stiprāka prioritāte nekā ?: operatoram? Saliec iekavas, lai izpildītu ?: pirms . operatora. Quote Link to comment Share on other sites More sharing options...
aika Posted June 24, 2009 Author Report Share Posted June 24, 2009 Ar iekavām jau pārbaudīju - nepalīdz Quote Link to comment Share on other sites More sharing options...
marcis Posted June 24, 2009 Report Share Posted June 24, 2009 Saliec iekavas pareizi un pārbaudi vēlreiz :) echo "aaa".(1==1?"bbb":"ccc")."ddd"; Quote Link to comment Share on other sites More sharing options...
bubu Posted June 24, 2009 Report Share Posted June 24, 2009 Atkal mānās, ka nepalīdz... visi tikai mānās un mānās :) Quote Link to comment Share on other sites More sharing options...
aika Posted June 24, 2009 Author Report Share Posted June 24, 2009 (edited) ar uzsvaru uz: Saliec iekavas pareizi un pārbaudi vēlreiz :) fk, es takš nav vainīgs, ka pieradis pārbaudi vienmēr iekavās likt :) BET enīvei php atgriež: selected="selected" Edited June 24, 2009 by aika Quote Link to comment Share on other sites More sharing options...
bubu Posted June 24, 2009 Report Share Posted June 24, 2009 Pārbaudi likt iekavās nav ne vainas. Kaut katru mainīgo liec iekavās, tas netraucēs. Kļūda ir tur, ko es jau #2 postā teicu - ka . operatoram ir lielāka prioritāte nekā ?: operatoram. Respektīvi kods $a?$b:$c.$d vispirms [var iedomāties, ka] izpildīs $c.$d un tikai tad sāks pārbaudīt $a vērtību un tad izvēlēties vienu no $b vai $c.$d variantiem. Saliec iekavas, ja gribi savādāk. Quote Link to comment Share on other sites More sharing options...
aika Posted June 25, 2009 Author Report Share Posted June 25, 2009 Tā pārbaude jau strādāja pareizi, abos gadījumos. Un selected="selected" kā izrādījās arī ir ok. Gūglē atradu problēmas sakni: What it boils down to: this is not a bug Smile Mozilla attempts to keep the currently selected form values on a page reload (do not "reset" them to the defaults). Therefore if you change which value was selected by default, tough luck.... mozilla still retains the currently selected value unless you shift-reload or press enter in the URL. Paldies. Quote Link to comment Share on other sites More sharing options...
bubu Posted June 25, 2009 Report Share Posted June 25, 2009 Nu tad tu nekorekti savu problēmu aprakstīji. Es to biju sapratis, ka tu saki, ka tev drukājas tikai selected="selected" un tālāk nekas. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.