nevermind, i just removed the whole section.dr_patso wrote:Hey Steve,
Is this right.. in your first reply to this thread you say to remove the start before section
what about the start after section do I get the whole thing or just how much you have in your code box??
Code: Select all
<!-- START CUSTOM AFTER --> <?php /* custom fields AFTER comments */ $print_table = 0; foreach ($hesk_settings['custom_fields'] as $k=>$v) { if ($v['use'] && $v['place']) { if ($print_table == 0) { echo '<table border="0" width="100%">'; $print_table = 1; }
requiring custom field with drop down box
Moderator: mkoch227
Re: requiring custom field with drop down box
Re: requiring custom field with drop down box
if you want your custom field to highlight in red upon error like the original required fields
Code: Select all
<td style="text-align:right" width="150" >Time Spent:<font class="important">*</font></td>
<td width="80%"><select name="custom3" <?php if (in_array('custom3',$_SESSION['iserror'])) {echo ' class="isError" ';} elseif (in_array('custom3',$_SESSION['isnotice'])) {echo ' class="isNotice" ';} ?> >
Re: requiring custom field with drop down box
Thats funny, after responding to your last inquiry, i started looking at my script, I noticed that I was missing that functionality.
Also, if your user has input text in all but one (or more) required feilds, and error is generated, but without the code below the data they entered will be lost and they will have to reenter it.
add this to the end of your string there
Also, if your user has input text in all but one (or more) required feilds, and error is generated, but without the code below the data they entered will be lost and they will have to reenter it.
add this to the end of your string there
Code: Select all
<?php if (isset($_SESSION['as_custom3'])) {echo stripslashes(hesk_input($_SESSION['as_custom3']));} ?>
-Steve
Re: requiring custom field with drop down box
lol Steve, I was just coming here to say i noticed that custom fields dropped any data upon another error.
I think with that code you just posted it's perfect, minus having to code in new fields which anyone managing a tool like this should be able to do.
I think with that code you just posted it's perfect, minus having to code in new fields which anyone managing a tool like this should be able to do.
Re: requiring custom field with drop down box
Hey steve where exactly do I put, not sure what you mean by the end of my string.
I've been plopping it all around my drop down and it doesn't seem to accomplish anything.
Code: Select all
<?php if (isset($_SESSION['as_custom3'])) {echo stripslashes(hesk_input($_SESSION['as_custom3']));} ?>
Re: requiring custom field with drop down box
Whenever I have questions about default HESK functionality, or where the code goes, I always consult the default Hesk 2.3 installation files. I run a separate installation of hesk that is just the basic install with no mods, that way if i remove of change something, I can always refer back to the base install.
Having said that, the code you need it this
Where "message" = your custom feild
Having said that, the code you need it this
Code: Select all
<tr>
<td style="text-align:right" width="150" valign="top"><?php echo $hesklang['message']; ?>: <font class="important">*</font></td>
<td width="80%"><textarea name="message" rows="12" cols="60" <?php if (in_array('message',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> ><?php if (isset($_SESSION['as_message'])) {echo stripslashes(hesk_input($_SESSION['as_message']));} ?></textarea><br /><br />
</td>
</tr>
-Steve
Re: requiring custom field with drop down box
this is how I nailed it for the custom fields with text input..
still working on the drop down.
the code added was
obviously you change custom2 to the appropriate field you are working on.
still working on the drop down.
Code: Select all
<tr>
<td style="text-align:right" width="150"><?php echo $hesklang['serialn']; ?>:</td>
<td width="80%"><input type="text" name="custom1" size="40" maxlength="25" value="<?php if (isset($_SESSION['as_custom1'])) {echo stripslashes(hesk_input($_SESSION['as_custom1']));} ?>"Autocomplete="off"/></td>
</tr>
<tr>
<td style="text-align:right" width="150"><?php echo $hesklang['contract_name']; ?>:</td>
<td width="80%"><input type="text" name="custom2" size="40" maxlength="25" value="<?php if (isset($_SESSION['as_custom2'])) {echo stripslashes(hesk_input($_SESSION['as_custom2']));} ?>" </td>
</tr>
Code: Select all
value="<?php if (isset($_SESSION['as_custom2'])) {echo stripslashes(hesk_input($_SESSION['as_custom2']));} ?>"
Re: requiring custom field with drop down box
I don't think
works for custom drop down menus.. just works for custom text fields
I think something like this would keep the custom drop down option selected if you error somewhere else.
Code: Select all
<?php if (isset($_SESSION['as_custom1'])) {echo stripslashes(hesk_input($_SESSION['as_custom1']));} ?>
works for custom drop down menus.. just works for custom text fields
I think something like this would keep the custom drop down option selected if you error somewhere else.
Code: Select all
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {$selected = ' selected="selected"';}
else {$selected = '';}
Re: requiring custom field with drop down box
I didn't test it on a drop down box.
Klemen may be able to provide an answer to that one.
Klemen may be able to provide an answer to that one.
-Steve
Re: requiring custom field with drop down box
Ok, figured that one out.
To make this work with drop down boxes use something like this
So your drop down list will look something like this
To make this work with drop down boxes use something like this
Code: Select all
<option value="Option1" <?php if ($_SESSION['as_custom1']=="Option1") {echo 'selected="selected"';} ?>/>Option1</option>
Code: Select all
<td width="80%"><select name="custom1" <?php if (in_array('custom1',$_SESSION['iserror'])) {echo ' class="isError" ';} elseif (in_array('custom1',$_SESSION['isnotice'])) {echo ' class="isNotice" ';} ?>>
<option value=""/>Please Select..</option>
<option value="Option1" <?php if ($_SESSION['as_custom1']=="Option1") {echo 'selected="selected"';} ?>/>Option1</option>
<option value="Option2" <?php if ($_SESSION['as_custom1']=="Option2") {echo 'selected="selected"';} ?>/>Option2</option>
<option value="Option3" <?php if ($_SESSION['as_custom1']=="Option3") {echo 'selected="selected"';} ?>/>Option3</option>
<option value="Option4" <?php if ($_SESSION['as_custom1']=="Option4") {echo 'selected="selected"';} ?>/>Option 4</option>
<option value="Option4" <?php if ($_SESSION['as_custom1']=="Option4") {echo 'selected="selected"';} ?>/>Option 4</option>
</td>
-Steve
Re: requiring custom field with drop down box
works for me! thanks Steve! slightly off topic: now i move on to your conditional drop down boxes mod.. if i can get that to work all i've got left for it to be perfect is requiring to update the time spent custom field before ticket can be resolved
Re: requiring custom field with drop down box
I have been playing with that one, I have been using a Javascript pop up box that prompts the user to enter some information before a ticket can be resolved.
Ill keep you posted on this. Im trying not to do to much more modification to Hesk, as I am waiting for 2.4 to come out so I can apply my efforts to that.
Ill keep you posted on this. Im trying not to do to much more modification to Hesk, as I am waiting for 2.4 to come out so I can apply my efforts to that.
-Steve
Re: requiring custom field with drop down box
EDIT: had a <tr> <hr /> formatting issue that didn't effect firfox but ruined the layout in IE.. I fixed.