chrometweaks.org

Does Anyone Know A Website That Has Free iPage web hosting?

Click Here To View All Answers...


Got a quick question: Does Anyone Know A Website That Has Free iPage web hosting? Hoping for any response. Second question.. Hi people of oscommerce....

I have made an attribute called "Please Select" and made it the top of the drop down menu... but I need to put a javascript alert in the product_info.php file so the user is forced to select an attribute from the drop down menu... my big problem is the whole form is in php, and I am not sure how to integrate the javascript commands into it. Basically, I know I have to put the onclick function to verify in the add to cart section right??? If anyone has successfully executed anything similar to this could you please help me?.

Thanks so much in advance.....

Comments (10)

You betcha! but you might want to make sure and wait for someone else to confirm this as I am not confident. Better yet, why don't you call the iPage guys because they can answer you better...

Comment #1

Hi,.

If I understood you correctly you want to make a drop down list that looks like;.

-Please Select-.

Attribute One.

Attribute Two.

Attribute Three.

The person would then have to choose one of the three attributes, and Please Select will return an error. This can be done with standard osC but I have taken my iPage site apart so many times I can't remember how..

If you want/need to use JS to perform the function that can be done also. I think you will find your JS answer in the readme file of my Canada Post Package Tracking contribution. The Canada Post iPage site is written in JS and uses the onclick="submitPIN('basicPinForm') function to take you from the page you enter the tracking number to the page where the tracking information is displayed. This JS was successfully incorporated into the osC php file..

1) Code goes above <head> in the PHP file..

<script language="JavaScript" src='./js/zisa_popup.js'></script>.

<script>.

Function validate(input) {.

If (input=="") return true;.

Var bad = "!?#$%^&*';:,~`<>\|[]{}()+=_@.-";.

Var doubleQ = '"';.

Var okay = true;.

If (input.indexOf(doubleQ)>-1) {.

 okay = false;.

}.

For (i=0;i<=input.length;i++) {.

 var c = input.substr(i,1);.

 if (c!="" && bad.indexOf(c)>-1) {.

 okay = false;.

 }.

}.

Return okay;.

}.

Function submitPIN(obj) {.

If (obj=="") return;.

Var formObj = eval("document." + obj);.

If (!validate(formObj.temp_trkid1.value)) {.

 alert('Invalid characters in the input fields. Please check your entries and try again.');.

 return;.

}.

If (formObj.temp_trkid1.value=="") {.

 alert('No Item number was submitted. Please enter a number and click Submit.');.

 return;.

}.

                  formObj.trackingId.value=formObj.temp_trkid1.value;.

FormObj.trackingCode.value='PIN';.

FormObj.submit();.

}.

</script>.

2) Code goes below </head> in the PHP file.

<body onload="getFocus('basicPinForm')" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">.

3)This code is the guts in the middle.

   if ($order->info['CP_track_num'] != NULL) {.

?>.

    <tr>.

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>.

     </tr>.

     <tr>.

       <td class="main"><b><?php echo HEADING_TRACKING; ?></b></td>.

     </tr>.

     <tr>.

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>.

     </tr>.

     <tr>.

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">.

         <tr class="infoBoxContents">.

           <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">.

             <tr>.

   <form name="basicPinForm" method="post" action="https://obc.canadapost.ca/emo/basicPin.do" target="_blank">.

   <input type="hidden" name="trackingId">.

   <input type="hidden" name="trackingCode">.

   <input type="hidden" name="action" value="query">.

   <input type="hidden" name="fromPage" value="basicPin">.

   <input type="text" name="temp_trkid1" maxlength="35" size="25" value="<?php echo $order->info['CP_track_num']; ?>">.

   <input type="button" value="<?php echo TEXT_BUTTON_CANADAPOST; ?>" onclick="submitPIN('basicPinForm');">.

   </form>.

   </td>.

             </tr>.

<?php.

?>.

           </table></td>.

         </tr>.

       </table>.

      </td>.

     </tr>.

<?php.

}.

I hope that helps you get started with your task,.

Peter..

Comment #2

Actually, what I need is just an alert box that pops up if the user didnt choose anything from the drop down... like so:.

If drop-down = "please select".

Then alert "please select an attribute from the menu".

Thank you for your help... it's much appreciated!..

Comment #3

Hi.

I thought you could give products attributes to choose from in the Admin/catalog/product attributes section of osc. Or are you looking for something that the stock dosent do?.

Toby..

Comment #4

Hypothetical drop down attribute list like so:.

Please Select.

Blue.

Red.

Green.

If you order the item and DONT select blue, red, or green, the order gets processed with the attribute "Please Select"... I need to force the user to select an attribute with a javascript alert. So when they hit "Add to Cart" and the drop down is set to "Please Select" they get an alert box that says "Hey stupid, you need to select an attribute from the drop down list"....

My problem is I can't figure out how to integrate javascript into the php coded page (file is catalog/product_info.php)... here's the section (I think) I need to edit (where the add to cart button is):.

Php echo tep_draw_hidden_field('products_id', $product_info['products_id'])tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>.

Usually with a javascript, you put your "onclick verify" in the submit button section of code... but I am not sure how to write it because it is half php...

Comment #5

Hi people of oscommerce....

I have made an attribute called "Please Select" and made it the top of the drop down menu... but I need to put a javascript alert in the product_info.php file so the user is forced to select an attribute from the drop down menu... my big problem is the whole form is in php, and I am not sure how to integrate the javascript commands into it. Basically, I know I have to put the onclick function to verify in the add to cart section right??? If anyone has successfully executed anything similar to this could you please help me?.

Thanks so much in advance.....

Comment #6

No, the whole form is not PHP. There is HTML scattered through it. You need to find the proper HTML code and modify it. Some of the HTML may be generated by functions called from PHP...

Comment #7


This question was taken from a support group/message board and re-posted here so others can learn from it.