EllisLab text mark
Advanced Search
     
[PENDING] Need help with CSS and Prototype (2 questions)
Posted: 19 July 2007 10:44 AM   [ Ignore ]
Joined: 2007-07-10
37 posts

I didn’t want to post my issues in the wrong topic and pollute the other forum, so I post it in the general forum. Please tell me if I did wrong.

There are two issues I must deal with :
1. Changing an hidden post value via JS;
2. Getting things from a form to align properly via CSS.

=======================================

1. Here is my HTML (generated via CI) :

<div id="mainbody"> <h2>Stocks</h2>

 <
form id="stock_search_form" method="post" action="***/index.php/stocks/stocksearch">
 <
div>
  <
label for="stock_site">Site</label>
  <
select name="stock_site" id="stock_site" />
   <
option value="ALL"><b>ALL</b> - ALL SITES</option>
  <
option value="OTH"><b>OTH</b> - Other option</option>
 </
select>
  <
img id="report_button" src="../img/Consultation.png" alt="Consultation" />
  <
br />
  <
label for="stock_product">Produit</label>
  <
input type="text" name="stock_product" id="stock_product" />
  <
input type="hidden" name="report" id="report" value="false">
  <
input type="image" id="search_button" src="../img/Rechercher.png" />
  <
div id="autocomplete_choices" class="autocomplete"></div>

 </
div>
 </
form>
 <
div id="stock_values" style="display:none;">
 <
p>Quantities in stock</p>
 </
div>
 <
hr />
  </
div

Here is my not working JS :

$('report_button').onclick = function() {
  button_check
();
 


function button_check() {
 alert(
$('report').value);
 if (
$report.value == "true")
 {
  
$('report').value "false";
  $(
'report_button').src "../img/Consultation.png";
 
}
 
else if ($F('report').value == "false")
 
{
  
$('report').value "true";
  $(
'report_button').src "../img/Rapport.png";
 
}
 alert(
$('report').value);

I’ve tried with $F() and $() but it seems that I misunderstood how it actually works.

2. Here is what it looks like :

http://pix.nofrag.com/13/62/6ce9b70d977e82a818f16f67f9a4.jpeg

And my not working CSS :

img {
 border
1px solid white;
}
#stock_values {
 
background#444444;
 
border1px solid #EAEAEA;
 
padding10px;
 
margin-top10px;
}

#stock_values ul {
 
margin0;
 
padding0;
 list-
style:none!important;
 list-
style-imagenone!important;
}

#stock_values ul li {
 
margin-bottom10px;
}

#stock_search_form {
 
colorwhite;
 
background#000000;
 
border1px solid #EAEAEA;
 
padding10px;
}

#stock_search_form label{
 
font-size:small;
 
displayinline;
  
floatleft;
 
width70px;
}

#stock_site {
 
width350px;
}

input {
 border
1px solid #888;
 
padding1px 2px;
 
font-sizesmall ;
 
color:white ;
 
background-colorblack;
}

select {
 border
1px solid #888;
 
margin0;
 
font-sizesmall ;
 
color:white ;
 
background-colorblack;
}

#stock_site option {
 
background-color:black;
 
colorwhite;
 
margin:0px;
 
padding:0px;
 
font-sizesmall;
 
display:block;
 
margin:0;
 
padding:2px;
 
cursor:pointer;
}

#stock_site option.selected {
 
background-color#666666;
}

#stock_product {
 
width300px;
}

#search_button {
 
colorblack;
 
background#FFF url(../img/search.png) no-repeat right center;
 
padding:0 25px 0 0;

I would like a perfect vertical alignement, and an horizontal alignment between the two buttons.

If you need more information, just ask, I’ve been stuck with these results for one day now.

 
Posted: 19 July 2007 11:46 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2002-08-31
23 posts

The JS problem I can help you with (your CSS image isn’t appearing for me..)

See if this works:

$('report_button').onclick = function() {
  button_check
();
}

function button_check() {
alert(
$('report').value);
if (
$F('report') == "true")
{
  $F
('report') = "false";
  $(
'report_button').src "../img/Consultation.png";
}
else if ($F('report') == "false")
{
  $F
('report') = "true";
  $(
'report_button').src "../img/Rapport.png";
}
alert($F
('report'));

$F(‘field_name’) returns the value directly, so you don’t need the .value part.

 
Posted: 19 July 2007 11:55 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-07-10
37 posts

Thanks for the reply!

The first alert shows up saying “false” which may be true since it’s ‘report’ initial value.
However I don’t have the second box showing up and the error console says :

Error : invalid assignment left-hand side
Source : http://*****/js/stock_search.js
Ligne : ($F(‘report’) = “true”;)

It seems that it does not want to change the ‘report’ value and stops JS.

 
Posted: 20 July 2007 05:07 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Joined: 2007-07-10
37 posts

I still need a bit of help. Is it impossible to change a value by using $F() or $() ?