Another question (yes, I ask wayyyy too many ;) )

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Another question (yes, I ask wayyyy too many ;) )

Postby TBloodfist » Tue Jun 28, 2005 10:10 pm

There do not appear to be any addons available, and I am not sure of the difficulty in accomplishing this. Is there a way to make certain fields available ont he submit/modify news after you specifiy a certain value in a previous field.

As a quick example, if you specify Canada - a list of provinces will be listed (in a dropdownbox). If you specify USA - a choice of states would be listed.

I always see Ecommerce sides doing this, so why can't Coranto? ;)

Thanks for the help.
TBloodfist
 
Posts: 39
Joined: Wed Jun 22, 2005 3:35 pm

Postby Esstee » Wed Jun 29, 2005 12:20 am

Very interesting indeed.

already I can see a use for this :D good call
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Wed Jun 29, 2005 1:56 am

Isn't this usually achieved with JavaScript? They always seem to update dynamically rather than loading the page again. I guess it could be done, but would probably require a perl coder who knows javascript to make the addon. Other than that I think it would not be too complicated.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Parahead » Wed Jun 29, 2005 5:54 am

Lumberjack wrote:Isn't this usually achieved with JavaScript? They always seem to update dynamically rather than loading the page again. I guess it could be done, but would probably require a perl coder who knows javascript to make the addon. Other than that I think it would not be too complicated.
Yes, they are often done through Javascript. Personally I try to stay away from JS solutions but like you say, it shouldn't be that hard to do the actual functionality on the submit page. My concern is how to make it userfriendly on the fields settings page, see below...

TBloodfist wrote:As a quick example, if you specify Canada - a list of provinces will be listed (in a dropdownbox). If you specify USA - a choice of states would be listed.
I understand what you want to do. Would it only be of interest for dropdownbox? If so, do you have a suggestion of how to enter the different dropdowns at the field settings page from a users perspective? Preferably a solution with a fixed amount of inputfields. It could become rather messy if trying to enter several dropdownboxes into the single line input as currently is available, so a slightly better approach needs to be used. Especially since the reason for having several dropdowns is that each contains a lot of options.
Yes, I am still around...
www.parahead.com/coranto/
User avatar
Parahead
 
Posts: 4837
Joined: Fri Jan 12, 2007 8:54 pm
Location: Stockholm - Sweden

Postby Lumberjack » Wed Jun 29, 2005 1:44 pm

We seem to have this issue in quite a few topics recently... this code from the XPoll addon might be useful:
Code: Select all
   print FieldsRow('Add Option',qq~<input name="option_$num" type="text" value="$in{"option_$num"}"><input type="button" value="Add Option" onclick="document.xp.optnum.value++;document.xp.dowha.value='addopt';document.xp.submit();">~);
   print qq~</table><br><div align="center"><input type="button" value="Add Poll" onclick="document.xp.dowha.value='submit';document.xp.submit();"></div></form>~;

That's from the XP_Add sub, and then I guess this (from the XP_AddSave sub):
Code: Select all
   if($in{'dowha'} =~ /^remopt(.+)/){
      for($n=$1;$n<=$in{'optnum'};$n++){
         $in{"option_$n"} = $in{'option_'.($n+1)}
      }
      $in{'optnum'}--;
      XP_Add();
   }elsif($in{'dowha'} eq 'addopt'){
      XP_Add();
   }

and below that:
Code: Select all
   foreach$i(@{"XP_OPT_Ids_$poll"}){
      print FieldsRow(qq~Option $num~,qq~<input name="option_$i" type="text" value="$XP_OPT_Option{$i}"><input type="button" value="Remove" onclick="document.xp.dowha.value='remopt$i';document.xp.submit();"~);
      $num++;
   }
   print FieldsRow('Add Option',qq~<input name="addoption" type="text"><input type="button" value="Add Option" onclick="document.xp.dowha.value='addopt';document.xp.submit();"~);
   print qq~</table><br><div align="center"><input type="button" value="Edit Poll" onclick="document.xp.dowha.value='submit';document.xp.submit();"></div></form>~;

etc... I guess it does also use javascript to do that, but it seems very efficient and not too much javascript that it gets in the way of the perl.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby bozoka45 » Wed Jun 29, 2005 4:06 pm

I know that this site has some Javascript that does that under the "Forms" section.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans


Return to Customization

Who is online

Users browsing this forum: No registered users and 4 guests

cron